Support

Account

Home Forums Add-ons Options Page Updated to 2.0.0, Broke Site php Error

Solved

Updated to 2.0.0, Broke Site php Error

  • Hi All, thank you for any help.
    Site was fine till update of Options Page add-on; Options Page version 2.0.0. WordPress version is the latest and ACF version is 4.4.11, site is running php 5.6. The error we get, that causes a white screen in admin and the frontend is;
    PHP Fatal error: Call to undefined function acf_extract_var() in /---/***/*-*/**--**/wp-content/plugins/acf-options-page/includes/options-page.php on line 96

    We did not build the site, we are just the new site managers. We have not used ACF before, it was part of this site and is used to build a “Theme Options” page for the custom theme. We have no way to contact the theme builder and the author of the theme is listed as “anonymous”.

    I found this code in the site’s functions.php file;

    /* advanced custom fields settings*/
    
    //theme options tab in appearance
    if(function_exists('acf_add_options_sub_page')) {
        acf_add_options_sub_page(array(
            'title' => 'Theme Options',
            'parent' => 'themes.php',
        ));
    }
    
    //acf theme functions placeholders
    if(!class_exists('acf') && !is_admin()) {
        function get_field_reference( $field_name, $post_id ) {return '';}
        function get_field_objects( $post_id = false, $options = array() ) {return false;}
        function get_fields( $post_id = false) {return false;}
        function get_field( $field_key, $post_id = false, $format_value = true )  {return false;}
        function get_field_object( $field_key, $post_id = false, $options = array() ) {return false;}
        function the_field( $field_name, $post_id = false ) {}
        function have_rows( $field_name, $post_id = false ) {return false;}
        function the_row() {}
        function reset_rows( $hard_reset = false ) {}
        function has_sub_field( $field_name, $post_id = false ) {return false;}
        function get_sub_field( $field_name ) {return false;}
        function the_sub_field($field_name) {}
        function get_sub_field_object( $child_name ) {return false;}
        function acf_get_child_field_from_parent_field( $child_name, $parent ) {return false;}
        function register_field_group( $array ) {}
        function get_row_layout() {return false;}
        function acf_form_head() {}
        function acf_form( $options = array() ) {}
        function update_field( $field_key, $value, $post_id = false ) {return false;}
        function delete_field( $field_name, $post_id ) {}
        function create_field( $field ) {}
        function reset_the_repeater_field() {}
        function the_repeater_field($field_name, $post_id = false) {return false;}
        function the_flexible_field($field_name, $post_id = false) {return false;}
        function acf_filter_post_id( $post_id ) {return $post_id;}
    }

    This code works with the old version of the Options Page add-on, was running version 1.2.0, but it has been suggested that this code is what is breaking the site with the new add-on version. Not sure though as the error says the problem is an undeclared var, acf_extract_var, which seems to be called by the new version of the Options Page add-on.

  • We are experiencing this exact same issue.

  • Anyone have advice for this?

  • Hi @ray and @redbacksolutions

    Elliot here – ACF dev.
    Firstly, my apologies for this bug.

    We found and fixed this bug shortly after release and re-uploaded the plugin files.
    Here are the avialbale solutions:

    1. Re-download the options page plugin
    2. Edit the plugin file ‘includes/options-page.php’ on line 96 to $page[ $new ] = $page[$old];
    3. Change your acf_add_options_sub_page() args array from ‘title’ to ‘page_title’

    Thanks
    Elliot

  • Thank you Elliot for your reply. Step one will not work as I do not have a copy of the old version to upload to the site in order for WordPress to show me an update. I did try searching for a download link but could not find one. Step 2 worked but step three did not.

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

The topic ‘Updated to 2.0.0, Broke Site php Error’ is closed to new replies.