my header.php page got erased when i trying to post google tag manger code , how can i retrieve it, rest of the theme is ok

If it’s a prebuilt theme (i.e. you downloaded it from WordPress.org or bought it somewhere), go to the author’s website and download a fresh copy. If it’s a custom theme, you’ll need to rely on your own backups – perhaps you’re auto backing up to a Dropbox, or you’re using a host that provides file … Read more

Plugin alternative to wp-blog-header.php hacks?

For anyone else who needs it, I solved it as follows via a plugin: (1) The first block of code needed to be triggered with: add_action( ‘wp_loaded’, ‘redirect_block’ ); (2) The second block involving redirects was originally after the wp(); call in wp-blog-header.php, so in the plugin it is triggered as follows: add_action( ‘wp’, ‘redirect_old_style_urls’ … Read more

Cannot Modify Header Information – While trying logging in

wp-includes/general-template.php:2102 is the function wp_admin_css(). On the login page this function is called in login_header(). Your theme or some plugin trys to send an HTTP header after that, probably during the actions login_enqueue_scripts or login_head. wp-includes/option.php on:569 is in function wp_user_settings(); a cookie is set here. Cookies are HTTP headers, so that cannot work when … Read more

What is the function of wp() in wp-blog-header.php

From the WordPress source code: “Set up the WordPress query.” (wp-includes/functions.php) The wp() method in turn calls the WP->main (wp-includes/class-wp.php), which has the following description: “Sets up all of the variables required by the WordPress environment. The action ‘wp’ has one parameter that references the WP object. It allows for accessing the properties and methods … Read more