Post Status INHERIT in database?
-
What is post_status=inherit in database ?
If its revisions I already turn off revisions in config file
why m getting these ?Suppose I add 15 images to a post no.21 and insert as a gallery in that post, then 15 new INHERIT posts(post no. 22, 23 ans so on…..) added to database !
I want to know that its wordpress default setup how much images I attach to post WP automatically creates Inherit posts for that number of images?
I read here
https://www.ads-software.com/support/topic/post_status?replies=4
that Inherit post is a revision !
then why m getting these after turning off revisions ??pls explain & also suggest any way/hack to turn it off as my posts& database increasing with these inherit posts :((
thanks….
-
If INHERIT Post type is REVISION , then can i remove it ?
or its required for Image to show attachment of post ?
?
As I sadly discovered, ‘inherit’ is apparently also the post_status of media attachments, and if you delete those, the gallery shortcode will no longer work.
This is probably OK:
DELETE FROM wp_posts WHERE post_status = 'inherit' AND post_type != 'attachment';
The following, residing as a php file in the WordPress directory, deletes attachment posts if there is not a corresponding “gallery”. It is designed to run as a daily cronjob.
<?php include('wp-load.php'); $query1 = "SELECT * FROM wp_posts WHERE post_status = 'inherit' AND post_type = 'attachment' AND DATE(post_date) > DATE_SUB(CURDATE(), INTERVAL 1 DAY"; $attachrows = mysql_query($query1); if ($attachrows) { while ($attachrow = mysql_fetch_array($attachrows,MYSQL_BOTH)) { $postid = $attachrow[post_parent]; $query2 = "SELECT * FROM wp_posts WHERE INSTR(post_content,'gallery') AND ID = " . $postid; mysql_query($query2); if (!mysql_affected_rows()) { $queryd = "DELETE FROM wp_posts WHERE post_status = 'inherit' AND post_type = 'attachment' AND post_parent = " . $postid; mysql_query($queryd); } } } ?>
Correction! I missed a closing parenthesis at the end of the first query:
$query1 = "SELECT * FROM wp_posts WHERE post_status = 'inherit' AND post_type = 'attachment' AND DATE(post_date) > DATE_SUB(CURDATE(), INTERVAL 1 DAY)";
Hey ericr, can you tell me what attachment posts are? I’m having a problem with worpdress posting 2 of the same posts but with different titles which Google caches both as unique posts even though they go to the same url and I dont know how to get rid of it. Any ideas? Thanks
An “attachment” post is only seen in the database. It is created for each piece of media that you upload when creating/editing a regular post.
So, for example, if you create a post that WordPress assigns as ID no. 432, and then you add a photo, the information about that photo is in an “attachment” post that may be numbered 433. (That’s why there are often gaps in the ID numbers of posts: the “missing” numbers are identifying the attachments.)
I don’t quite understand your problem. Can’t you simply delete one of the posts?
Well, in the post admin you only see the good post with the good title. And its the same way in the database it looks like. However Google caches 2 different posts for each post I make and they both go to the same URL. One has the correct title, one always comes out in the form “[keyword] – Comments for [domain]”. Its very strange. Ive never ran into this before a few months ago, could have something to do with Google Panda perhaps. I looked at the source code of the 2 cached posts that lead to the same url and they are identical, even in title tags except for strange in-line css styling that appears on every word inside of certain important tags, like the title tags. So it seems Google is thinking this is duplicate content, and whats worse, the post with the incorrect title is the one that ranks up in google because it doesnt have strange in-line css styling applied in weird places. I’ve done everything I can think of, right now I’m trying to add a robots.txt file that will disallow pretty much everything, – comments, feed, trackback, everything. I’ll let you know how it turns out unless you can offer a better solution? No ones ever seen this before. Thanks for the reply btw
It’s clearly a Google issue. I’ve seen similar indexing weirdness, but not such duplicate indexing. One thing, do you have any site-indexing plugin, such as Google Sitemap Generator? Could it be listing the post twice, once with your permalinks, once with ?p=…? Or maybe you changed your permalinks at some point, and you have lots of backlinks to this article to the old link? There’s no figuring out Google, of course – I’m just thinking out loud.
A) Log into Google Webmaster Tools and create validation html file and upload that to site root.
B) Create a sitemap.xml file and place in root (find and remove any bad or broken links from this file and add any missed etc.).
C) Create a Robots.txt file and place in root of site.Give the bots time to do their thing (which when handled this way will surprise you how quickly your site gets indexed!)
Also make sure you have the proper meta tags for title, content and keywords in the header.
And yes, use only one method, if you changed permalinks ever and are using a plugin, check with plugin on how to fix.
Thanks guys! You wouldn’t believe how hard it is to get any help with this issue.
ericr23, yes, I am using the Google XML sitemaps plugin. I’ll check Google now to see if anyone else has had similar problems using that plugin. I did change permalinks at one time, however even new posts that have no backlinks yet seem to have this issue right when they get indexed. I had thought it was a theme issue because I deleted everything, uninstalled wordpress, then made some posts with the default theme without changing anything in the theme first. Then I installed a theme that I had bought, made some posts, waited for Google to index those and they seemed ok. Then I changed the theme in the editor (nothing too much, just changed background images, header sizes and stuff, and I also changed the way posts were displayed in index.php and archives.php then tried posting some new posts and the posts came out strange again. So I thought that changing certain themes in the editor and not just using the theme the exact way it was uploaded might have been the problem but I didn’t check other variables like the XML sitemaps plugin. I had tried deleting all other plugins except for the sitemaps plugin before I uninstalled/reinstalled wordpress and used the default theme and that didn’t work. I didn’t think it was the sitemaps plugin but after your comment I’m rethinking the possibility that this could be the issue.
SwansonPhotos, thanks for the reply, I have been using the xml sitemaps plugin but I just last night tried using a robots.txt file. I woke up this morning and checked and a lot of what Google had chached was completely deindexed. Even the posts that I wanted to keep on there. I don’t know if its because of a problem with my robots.txt file or if Google had just not seen those posts in a while because I completely deleted everything and I hadn’t reposted those posts until last night (it had been probably 3 days that I had those posts removed). Here is what I have in my robots.txt file. Can you take a look and see if it looks alright?
Sitemap: https://domain/sitemap.xml (real domain is in the actual robots.txt)
User-agent: Googlebot
Disallow: /*/trackback
Disallow: /*/feed
Disallow: /*/comments
Disallow: /*?*
Disallow: /*?
Disallow: /*page/*User-agent: *
Disallow: /cgi-bin/
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/themes/
Disallow: /trackback
Disallow: /comments
Disallow: /feedThanks again guys.
All you need to do with the robots.txt file is point to the sitemap, and perhaps specific when and how to crawl, making sure the sitemap is in a web readable folder (root). Neither the sitemap nor the robots.txt stop a bot from crawling your site…any bot can and will read any ‘web accessible’ pages, links, etc…what these files do is indicate a ‘preference’ to how the site is ‘listed’ on the search engines. My example:
User-agent: * Allow: / Crawl-delay: 10 Request-rate: 1/10m Robot-version: 2.0 Sitemap: /your_sitemap.xml Visit-time: 0100-0700
If a folder or file is web readable, it can and will be crawled…make sure these are not web writable! The wp subs should have a default index.php file (Silence is golden!) And, it is probably best not to note the structure of your site to the public…
didnt work. im about to give up. at least for some reason now the posts with the correct titles are showing up first in the search engines.
It works great and my sites all show up in top results due to following my own instructions…
- The topic ‘Post Status INHERIT in database?’ is closed to new replies.