Support

Account

Home Forums Backend Issues (wp-admin) Location value disappear

Solved

Location value disappear

  • Hi Elliot, in one of the WP intallations that i’ve, i had this strange behaviour:
    Create a new fields group, add some custom fields, then when you choose the location, eg “Page”, you will have to set “it’s equal to” or “it’s not equal to”, and till that it’s ok, but the value select isn’t shown! I can’t choose any page value because the select element (<td class=”value”>) with the pages list isn’t there, or better, is there but is empty after the animated loading loop gif go away!
    Then i publish the fields group and after will appear the pages list, so i can choose.
    Seems that this problem appears only when creating a new fields group, then you publish and the problem go away.
    I’ve monitored the console with firebug searching for some jQuery errors or warnings, but all seems fine, no error messages from firebug console.

  • Another detail:
    create a new repeater field, till i don’t save the fields group, i can’t see the selects elements to choose the fields to be inside the created repeater.

  • Hi @Rics

    Thanks for the explanation. This all points to a JS error on the page is preventing an ACF JS from running.

    Can you open your console log and check for errors when on the field group edit page?

    thanks
    E

  • Hi Elliot,
    i got this message into the supposed locations list when changed “Show this field group if” select list:

    “Fatal error: Call to undefined function get_page_templates() in ../wp-content/plugins/advanced-custom-fields/core/controllers/field_group.php on line 633”

    On the Firebug console i don’t get any error or alert message, into the Firefox console i get this one:

    “[11:31:16.050] An empty string was sent to getElementById(). @ /wp-admin/post-new.php?post_type=acf”

    I’ve also tried the Chrome console, but over there no messages were displayed.

  • Hi @Rics

    Yes, this PHP error would definitely be the issue.

    Is there anything else you can provide to understand why a core WP function is not available? Is your WP setup very custom?

  • Uhm, yep, i could try an “exclusion” verify.
    I would start deactivating plugins one by one and verify and then trying to remove custom functions on functions.php file.
    I’ll keep you updated here.

  • Ok, seems that a call to wp ajax into the functions.php caused the problem.

    I had this code into functions.php used to process data for a form:

    // this hook is fired if the current viewer is not logged in
    	do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] );
    	// if logged in:
    	do_action( 'wp_ajax_' . $_POST['action'] );
    	add_action( 'wp_ajax_nopriv_gfl', 'gfl' );
    	add_action( 'wp_ajax_gfl', 'gfl' );
    	function gfl() {
    		if (isset($_POST['id'])){
    	        $id = $_POST['id'];
    	        $tr_type = get_tr_type($id);
    	        echo $tr_type;
    	    }else if(isset($_POST['to_id'])){
    	        $id = $_POST['to_id'];
    	        $tr_type = get_tr_type($id);
    	        echo $tr_type;
    	    }
    		exit;
    	}
    	add_action( 'wp_ajax_nopriv_gtl', 'gtl' );
    	add_action( 'wp_ajax_gtl', 'gtl' );
    	function gtl() {
    		$from_id = $_POST['id'];
    	    $to_id = $_POST['to_id'];
    	    get_to_locations($from_id,$to_id);
    		exit;
    	}

    Now i’ve wrapped this code between an is_admin() condition:
    if (!is_admin()) { // Ajax Code }

    Seems that the location is now working well.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Location value disappear’ is closed to new replies.