• 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

Display the WooCommerce product price inside a custom function

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

Can't remotely connect to MySQL error (13) with PHP script, connecting through CLI works

How to get monthly wise data in laravel

if statement inside concatenation

Woocommerce Checkout - Add conditional field required if one field is filled

Failing validation doesn't stop code execution in livewire component

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

Parameter is not sent to Laravel route in Ajax

How to Create WooCommerce Subscription Product via. REST API?

Call to undefined function openssl_decrypt

Updating and Synchronizing Woocommerce Subscriptions to Custom Date

PHPExcel file download using AJAX call

SQLSTATE[HY000]: General error: 1 table posts has no column named *

Detect if PHP session exists

About Contact Privacy policy Terms and conditions