$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>categories - Posts Missing in Dashboard after update|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

categories - Posts Missing in Dashboard after update

matteradmin8PV0评论

I did many updates to a WordPress site including a WP update to 5.0.3 for a client. After the updates, many posts were missing from the home landing page and other pages. Although the categories settings were still set as they were before the updates, when I removed/published and then replaced/published the categories the pages returned to their original places.

However, the client says that there are still many posts missing from the site. I looked into the wp_posts table and checked how many records.

SELECT count(*) FROM `wp_posts` WHERE 1

count(*)    
371

However, the WordPress dashboard only shows 47 posts in total.

Is there a reason for this? Is there a way to regain those posts by fixing anything that may be wrong in the database? What other options do I have for restoring those posts?

I did many updates to a WordPress site including a WP update to 5.0.3 for a client. After the updates, many posts were missing from the home landing page and other pages. Although the categories settings were still set as they were before the updates, when I removed/published and then replaced/published the categories the pages returned to their original places.

However, the client says that there are still many posts missing from the site. I looked into the wp_posts table and checked how many records.

SELECT count(*) FROM `wp_posts` WHERE 1

count(*)    
371

However, the WordPress dashboard only shows 47 posts in total.

Is there a reason for this? Is there a way to regain those posts by fixing anything that may be wrong in the database? What other options do I have for restoring those posts?

Share Improve this question edited Feb 20, 2019 at 22:27 I'm Root James asked Feb 20, 2019 at 21:01 I'm Root JamesI'm Root James 1238 bronze badges 2
  • What are these posts? Your SQL query doesn’t have any where, so it will show all posts. And that means that it will include attachments, menu entries, trashed posts, and so on... – Krzysiek Dróżdż Commented Feb 20, 2019 at 21:07
  • Do you know where I can properly search for all posts (not pages or categories) in the database? Or else if there are posts missing from the dashboard, do you know of a way to try and recover them? – I'm Root James Commented Feb 20, 2019 at 21:19
Add a comment  | 

1 Answer 1

Reset to default 1

Your SQL query is correct, but... There is no proper WHERE part in it:

SELECT count(*) FROM `wp_posts` WHERE 1

So it will count all rows in that table. And that table contains posts, but also much more...

First of all, this table contains column post_status. Some posts may be trashed, for example and you will still count them.

But there is even bigger problem with this count. You ignore the type of posts (column post_type). And WordPress stores many objects as "posts". For example all attachments from Media Library are stored in wp_posts table. Items of menus are also posts. And posts have revisions - they also are stored as posts.

So to check what posts are there in DB, you'll have to use query like:

SELECT * FROM wp_posts

and check all of them one by one. This will show you all posts in this table and you'll be able to check what posts are missing.

And if some posts are not in that table any more, then it will be impossible to restore them (unless you have any backups).

Post a comment

comment list (0)

  1. No comments so far