• 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 remove index.php and index from the URL using htaccess | PHP

Wordpress add responsive srcset header image to theme

How do I upload a laravel project on cPanel shared hosting?

How can I access an array/object?

Converting array to string and then back in PHP

Laravel MSSQL Server Connection not working

Set quantity minimum, maximum and step at product level in Woocommerce

PHP, how to convert Int value to Week days

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

Php - Sum up the numbers in an array one by one

PHP Discord OAUTH2 code sample not working

Hi, I am making a contact form thingy, and my php isn't working any reason why?

Minimum order amount except for specific shipping method in WooCommerce

carbon generated datetime not stored correctly into the database

Last order would be re-order in wooCommerce. How is it possible?

About Contact Privacy policy Terms and conditions