• If Pages Posts gives you the following error at the bottom of your blog:

    Fatal error: Call to a member function get_queried_object() on a non-object in /……/wp-includes/admin-bar.php on line 440

    and breaks the admin bar when you’re logged in, this is the solution:

    In “functions.php,” insert the following line on line 238:

    $wp_query = $GLOBALS['wp_query'];

    There should be THREE closing braces } before that line, and TWO closing braces } after the line.

    The goal is to have it after the switch() statement that starts on line 138.

    After making this change, the admin bar will work, and the error will go away.

    This fix is needed as of Pages-posts version 2.1. Hopefully it will be fixed in future releases.

    http://wordpress.org/extend/plugins/pages-posts/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello

    I am just trying to sort this out as I have having this error message.

    I am new to editing PHP so would really appreciate some help 🙂

    So far I have gone in to the plugin via the plugins page of my site and gone to ‘edit’. I have selected functions.php and gone in to edit. But I cannot seem to position the extra bit ($wp_query = $GLOBALS[‘wp_query’];) in the right place. I cannot find it. I have counted the lines to line 238 but still putting the text there doesn’t seem to work.

    Any help would really be appreciated.

    Thank you

    Martine

    Gengar03

    Brilliant, just brilliant. Followed your detailed advice and it worked like a charm. (BTWE: It wasn’t exactly at line 238, for me at least, but just above – with the braces count it was a doddle.

    Thanks a squillion. You are my hero.

    Cheers

    Tom

    Hi Gengar003 and tombyrnes!

    I see you have were able to fix the problem.
    Thought I’m having some problems with placing the:
    $wp_query = $GLOBALS['wp_query']; (within the functions.php)

    Can’t really find the three }’s and the two {‘s either..

    Anyone able to help me out, would be really appreciated!

    Attention pvdw:

    For me the change was around line 228. Look for the following lines:
    ———————————————————-
    if($showAsHome)
    {
    // Flag as a home page
    $GLOBALS[‘wp_query’]->is_home = true;
    $GLOBALS[‘wp_query’]->is_archive = false;
    $GLOBALS[‘wp_query’]->is_category = false;
    }
    }
    }
    —————————————————————-
    NB There will only be one such group of “wp_query” references that is followed by THREE closing braces. After those three closing braces AND before the next TWO closing braces, insert the line:
    $wp_query = $GLOBALS[‘wp_query’];
    —————————————————————–
    so you should end up with something like:
    —————————————————————-
    if($showAsHome)
    {
    // Flag as a home page
    $GLOBALS[‘wp_query’]->is_home = true;
    $GLOBALS[‘wp_query’]->is_archive = false;
    $GLOBALS[‘wp_query’]->is_category = false;
    }
    }
    }
    $wp_query = $GLOBALS[‘wp_query’];
    }
    }

    if(!function_exists(‘pagesPostsAdmin’))
    ———————————————————————
    if you still don’t get it, post another message with your email address suitably masked (eg “at” for “@” “dot” for “.” kinda thing.
    Good luck.

    I’m very much getting the feeling that my functions.php is totally different from yours.

    Maybe it’s indeed beter to handle this via email.
    If you’d be so kind to email me at: needatisprive at gmail dot com

    Thanks in advance!

    Hi pvdw

    Detailed email sent to the address you provided.
    Let me know if you get it OK.

    Hi Tombyrnes,

    I received your email and you totally solved my problem!.

    My problem was looking at the incorrect functions.php (I looked at the Twenty Eleven theme functions.php)

    For others who are having the same problem and can’t figure it out.
    The file you should be modifying is located at:
    “root/wp-content/plugins/pages-posts/functions.php”

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Pages Posts] [SOLVED] Fatal error: Call to a member function get_queried_object()’ is closed to new replies.