• 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

If action is on a different page do I use fwrite function

Make Shipping Method fields Mandatory on Woocommerce checkout page

Filter WooCommerce products with post__in and additional meta queries

Laravel 5.1 Unknown database type enum requested

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

How can I make a full text index of the column?

How do I call Validator from a namespace with an already existing Validator class

GuzzleHttp Hangs When Using Localhost

PHPExcel_IOFactory::createWriter causes wrong behaviour

Detect a fetch request in PHP

PHP | "The requested PHP extension bcmath is missing from your system."

Convert regular text to array using notepad++

AJAX call fails with SyntaxError: Unexpected end of JSON input

LARAVEL: How to fetch id dynamically in a query builder?

How to remove index.php and index from the URL using htaccess | PHP

About Contact Privacy policy Terms and conditions