If the pages and posts in your blog have suddenly disappeared from the admin list screens, you’re probably panicking, wondering what sorcery hath befallen your blog :-O
Worry not, I’m fairly certain you’ve recently added some code to your functions.php file that included a global variable that did this. It could be a really poorly-coded plug-in as well, but my money is on the fact you probably got some code from someone online who suggested you paste it into functions.php and BLAMO! your posts and pages went with it.
The problem is that the code did not exclude itself from the admin area of the site. If the code you pasted into functions.php (or plug-in you installed) is one that alters the main query, say for a custom post type, then it also has to exclude itself from admin or it will affect your admin lists as well.
I accidentally did this when overriding the main query for a custom post type archive using the pre_get_posts
action. Make sure you use !is_admin()
in your conditional statement and all will be right in the admin world again.