WordPress.org

Ready to get started?Download WordPress

Forums

Code Dump at bottom of every page after upgrading WP (19 posts)

  1. 10Ten
    Member
    Posted 3 years ago #

    RE: dbacu.com
    My WP install was fine until i just did an automatic prompted WP upgrade. All the plugins/themes were up to date before upgrading WP. The upgrade was "successful" and reported no problems. However:
    1 - after upgrading ALL my pages have a massive code dump at the bottom that appears to show content of ALL my pages. even my dashboard page has this dump. this occurred exactly after upgrading WP ten minutes ago, the site was fine before that.
    2 - after upgrading WP reports that i'm using a "nightly build" although i did not choose such an option. so i upgraded again to the latest version, it was "successful", and i get the same message to update because of using a nightly build.

    i cannot find any mention of this, can anyone help please?

  2. 10Ten
    Member
    Posted 3 years ago #

    update, cannot duplicate this problem when logged out as an admin. some local issue here.

  3. joshkerr
    Member
    Posted 3 years ago #

    I am also experiencing this problem. Did you find a quick fix for it?

  4. joshkerr
    Member
    Posted 3 years ago #

    Actually, I was able to fix it. The wordpress admin bar in 3.1 is bugged. Remove it via this code in your custom functions file:

    remove_action( 'init', 'wp_admin_bar_init' );
    foreach ( array( 'wp_footer', 'wp_admin_bar_render' ) as $filter )
    	add_action( $filter, 'wp_admin_bar_render', 1000 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_me_separator', 10 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_account_menu', 20 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_blogs_menu', 30 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_blog_separator', 40 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_bloginfo_menu', 50 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_edit_menu', 100 );
    remove_action( 'wp_head', 'wp_admin_bar_css' );
    remove_action( 'admin_head', 'wp_admin_bar_css' );
    remove_action( 'wp_footer', 'wp_admin_bar_js' );
    remove_action( 'admin_footer', 'wp_admin_bar_js' );
    remove_action( 'wp_ajax_adminbar_render', 'wp_admin_bar_ajax_render' );
    remove_filter( 'locale', 'wp_admin_bar_lang' );
  5. 10Ten
    Member
    Posted 3 years ago #

    are you really? i have had my site checked on multiple computers, multiple OS's, and multiple configs and cannot duplicate, but i have a theory that it's related to: 1) being logged into WP as an admin combined with 2) some plugin issue, possibly a security plugin.

    when logged in to the affected computer, clearing cache etc would not change the problem and the code dump appeared. but when i logged out as an admin the dump was gone. i do not have any debugging plugin or script running, so the dump is very mysterious at this point.

    by the way, the dump began with:

    Debugging blog #1 on [server address]
    
    PHP Version: 5.2.12
    
        * Object Cache
    
    Cache Hits: 578
    Cache Misses: 26
    
    Group: options
    Cache:
    
    Array
    (
        [alloptions] => Array
            (
    ...
  6. joshkerr
    Member
    Posted 3 years ago #

    I think it is code from the admin bar that some dev forgot to comment out before checking it in. My bet is the next build won't have the problem. I've read that the admin bar is buggy though.

  7. 10Ten
    Member
    Posted 3 years ago #

    ok thanks for that. i'll try that if she shows up again.

  8. Astriker
    Member
    Posted 3 years ago #

    Hello, what is the specific file that needs to be updated? And is that code the updated that can be pasted in it?

    Many thanks for advising a fix!

  9. Geezerjim
    Member
    Posted 3 years ago #

    You can add the code provided by joshkerr to your theme functions file.

  10. Astriker
    Member
    Posted 3 years ago #

    Does it matter where it is added? Sorry, have not had to do code fixes in a long time in WP

  11. Geezerjim
    Member
    Posted 3 years ago #

    I just appended it to the very bottom of the theme functions file.

  12. Astriker
    Member
    Posted 3 years ago #

    I put it on the bottom, after the last > and before it, after -

    }

    function file_put_contents($filename, $data) {
    $fhandle = @fopen($filename, 'w');
    if (!$fhandle) {
    return false;
    } else {
    $fcontents = fwrite($fhandle, $data);
    fclose($fhandle);
    }
    return $fcontents;
    }

    }

    but it errored and showed the code on the menu, not sure if that was supposed to happen or not. Also, do I put in my server (if I can figure out) or is that just a default.

  13. Geezerjim
    Member
    Posted 3 years ago #

    Just add this:

    remove_action( 'init', 'wp_admin_bar_init' );
    foreach ( array( 'wp_footer', 'wp_admin_bar_render' ) as $filter )
        add_action( $filter, 'wp_admin_bar_render', 1000 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_me_separator', 10 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_account_menu', 20 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_blogs_menu', 30 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_blog_separator', 40 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_bloginfo_menu', 50 );
    remove_action( 'wp_before_admin_bar_render', 'wp_admin_bar_edit_menu', 100 );
    remove_action( 'wp_head', 'wp_admin_bar_css' );
    remove_action( 'admin_head', 'wp_admin_bar_css' );
    remove_action( 'wp_footer', 'wp_admin_bar_js' );
    remove_action( 'admin_footer', 'wp_admin_bar_js' );
    remove_action( 'wp_ajax_adminbar_render', 'wp_admin_bar_ajax_render' );
    remove_filter( 'locale', 'wp_admin_bar_lang' );

    in to the theme functions file. You can do that through Appearance >> Editor from the admin back end.

  14. Astriker
    Member
    Posted 3 years ago #

    Sorry to be such a pain, but where would I add it in the code, I tried start, bottom and when I click save, the next page loads with the code showing and nothing else.

  15. Geezerjim
    Member
    Posted 3 years ago #

    From the admin side go to Appearance >> Editor. Find "Theme Functions (functions.php)" in the list of files on the right. Click on that and add the code to the bottom of that file. Click "Update File" and you should be done.

  16. Astriker
    Member
    Posted 3 years ago #

    Added on bottom to Functions.php, update file -

    Parse error: syntax error, unexpected T_FOREACH, expecting T_STRING or T_VARIABLE or '$' in /hermes/bosweb/web280/b2804/ipw.astriker/public_html/blog/wp-content/themes/atahualpa/functions.php on line 19

  17. Geezerjim
    Member
    Posted 3 years ago #

    I'm afraid we've reached the end of my limited abilities. I hope someone else reading this can provide some additional help. I wish I could be of further assistance.

  18. elfin
    Moderator
    Posted 3 years ago #

    I don't mind the menu appearing, but the debug info is full of validation errors - which makes testing other things a little difficult.

    So rather than remove the admin bar entirely, it is possible to just stop the debug info from being added to your page. obviously you'll need to deactivate this at some point to check if it's working. but this is the short plugin to achieve it:

    <?php
    /*
    Plugin Name: admin bar debug off
    Plugin URI: http://wordpress.org/#
    Description: quick fix
    Author: Rich
    Version: 0.0.1
    Author URI: http://elfden.co.uk
    */
    
    add_filter('wp_admin_bar_enable_debug_menu', 'stop_admin_bar_enable_debug_menu');
    function stop_admin_bar_enable_debug_menu(){
    	remove_action( 'wp_after_admin_bar_render', 'wp_admin_bar_query_debug_list' );
    	return false;
    }
    ?>

    Obviously it could also be added to your active theme's function file, but is probably better as a plugin.

  19. Astriker
    Member
    Posted 3 years ago #

    Created the php, zip, worked like a charm, THANK YOU!

Topic Closed

This topic has been closed to new replies.

About this Topic