• 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

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

How Can I Do LIMIT 1, 2 In WP_Query

Yii2 select2 database exception number of bound variables does not match number of tokens

How to display MySQL table using php and edit it in a web browser

Laravel Model save() & update() Not Saving

Yii2 redirecting to previous page after login

phpseclib 2.0 can not use Composer to create autoload

Adding one microsecond to Datetime object in PHP

Array to string conversion

PHP if in_array() how to get the key as well?

PHPSpreadsheet - How Do I Use Auto Migration Tool

cakephp save drag and drop list order to database

Clear javascript source cache laravel 5.8

With doctrine ODM, can I embed many subdocuments in a main document?

About Contact Privacy policy Terms and conditions