• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

phpwordpress


PHP Snippet 1:

add_action( 'acf/init', 'custom_code' );

function custom_code() {
    acf_add_local_field_group(array(
        'key' => 'group_1',
        'title' => 'Page Hero',
        'fields' => array (
            array (
                'key' => 'field_1',
                'label' => 'Hero Title',
                'name' => hero_title,
                'type' => 'text',
            )
        ),
        'location' => array (
            array (
                array (
                    'param' => 'post_type',
                    'operator' => '==',
                    'value' => page,
                ),
            ),
        ),
    ));
}

Related Snippets

SlimExceptionHttpNotFoundException

Store / Website Column in Magento 2 Admin Grid - Custom Module

Encrypt in php and decrypt in Dart(flutter)

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

Comma separated list from array with "and" before last element

Phalcon: setStatusCode returns empty response

500 (Internal Server Error) with Laravel & Docker [duplicate]

Form repeater send wrong data with last element in Laravel

Laravel - Browser displays message again when I press back button

Symfony Error: "An exception has been thrown during the rendering of a template"

How to add a heading in between checkout fields of WooCommerce

How to programmatically find public properties of a class from inside one of it's methods

The difference when using if statement true === something() vs something() === true [duplicate]

Unable to run composer install

How to create a individual template for page or post in custom plugin?

About Contact Privacy policy Terms and conditions