• 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

How to submit the custom form data in database in WordPress without plugin using ajax?

Access denied for user 'homestead'@'localhost' (using password: YES)

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

Telegram bot doesn't answer

Google Calendar API batch request PHP

Prestashop webservice API creating cart rules

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

How to set time with DateTime modify?

Show Custom Data in Woocommerce Order Details Admin Area

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

PHP rotate matrix counter-clockwise

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

Query Optimization, changing the queries in the loop into a single processing query

Update Order custom Field value with WooCommerce REST API

How do I Post to .txt document before form submits

About Contact Privacy policy Terms and conditions