Support

Account

Home Forums General Issues acf/init not triggring

Unread

acf/init not triggring

  • Hello,
    I have a strange problem that I can’t solve. It has the following simplified structure.

    
        function getPageLanguage() {
            // get_Language
            $getPageLanguageOption = get_field('wkdm_language_settings_current_language', 'option');
            $returnLanguag = "";
    
            if ($getPageLanguageOption == "") {
                $returnLanguag = "de"; // Standard-Sprache auf "de" setzen
            } else {
                $returnLanguag = $getPageLanguageOption;
            }
    
            return $returnLanguag;
        }
    

    this is in a PHP file I have in functions.phopdirectly as the first include.
    After that I include another file there I have

    
    $languageTest = getPageLanguage();
    if(getPageType() == "WKDM" && $languageTest == "de" ){
    }
    add_action("acf/init", "my_acf_init_test");
    function my_acf_init_test() {
    // not triggering
    }
    

    But if I remove the query on $languageTest in the first if query, acf/init is triggered.
    The same applies if I remove the get field from the getPageLanguage() function and set a language directly.
    But I do not get an error message. The return from the function is also correct.

    ACF Init also triggering if i put it before the if statement

    Im Using ACF pro Version 6.3.6

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.