Forum Replies Created
-
Thanks! This is EXACTLY the info I was looking for. So, three of MY columns (post_parent, post_name, and post_author) have no keys. My wp_posts table does not have a type_status_date column. Might be added by another plugin.
I will make a copy of the wp_posts table, set the above three columns to INDEX keys in the table copy, make a backup of the DB, rename wp_posts to wp_post_OLD and wp_posts_copy to wp_posts, and see if this resolves the SQL query error.
BRB…
WOO HOO!!!! My Forum is back in business! Posts and Replies are now displayed. YAY!
Caveat: DO NOT select MULTIPLE columns to set as INDEX. It will group them in to one index/key and name it to the last box checked. Select one column at a time and set to INDEX. This will create the proper SQL query and name each column index key to the name of the column, as shown in the Indexes listing in linked image in the previous post.
THANK YOU again, Robin, for your help! So much appreciated.
I’ve learned my lesson… DO NOT restore a WP database from a WHM > Acronis backup! It doesn’t preserve keys/indexes. The Acronis Backup restore had an option to Auto Increment. I did not investigate what this meant, and left it disabled, resulting in all needed tables NOT having their primary keys auto incremented. This began trashing several tables as WP stuffed them with new records with IDs of zero, thus breaking the site via loads of database and PHP fatal errors due to “missing” variables not able to be found in the database, due to it becoming more corrupted by non-auto-incrementing ID columns and lack of primary and index keys.
Field Type Collation Null Key Default Extra Privileges post_parent int(11) NULL YES — NULL — select,insert,update,references
Field Type Collation Null Key Default Extra Privileges
post_parent int(11) NULL YES — NULL — select,insert,update,referencesIs the column structure above correct for BBP? It seems that a blank/null value for Key might be the cause of the error in that the FORCE INDEX command works only on indexes (or keys) [right?], which the property of this column is not defined, thus throwing the error, correct?
Should I experiment and set this column to be an INDEX key?
It’s in the OP.
Can you confirm what type of constraint is present on the post_parent column? The error uses the word KEY, which is a constrained column. Obviously, it can’t be a PRIMARY key, since ID is PRIMARY and AUTO INCREMENT, so post_parent set as UNIQUE, INDEX, or other?
Now, I can run SQL in phpMyAdmin directly addressing post_parent, as in SELECT * FROM
wp_posts
WHEREpost_parent
!= 0 ANDpost_type
= topics ORpost_type
= replies;
and the result is a screen full of all topics and replies.Yet this particular query syntax: SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts FORCE INDEX (PRIMARY, post_parent) throws the “doesn’t exist” error, so it must have something to do with the properties of post_parent not being an INDEX? So, HOW to make it one, per the above question.
I’m looking directly at wp_posts table. post_parent key has matching values to post_type records (topics, replies) and verified by your code returning zero for any mismatches.
I’ve also added a copy of my theme’s page.php (parent = Kyma, child = Frontech), renamed it bbpress.php, and put it in both parent and child root theme folders (unaltered, because there’s nothing in the theme interfering with the layout and placement of BBP). No change.
I just discovered more at the end of the PHP error…
LIMIT 0, 15 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), apply_filters(‘template_include’), WP_Hook->apply_filters, bbp_template_include, apply_filters(‘bbp_template_include’), WP_Hook->apply_filters, bbp_template_include_theme_compat, BBP_Shortcodes->display_topic, bbp_get_template_part, bbp_locate_template, load_template, require(‘/plugins/bbpress/templates/default/bbpress/content-single-topic.php’), bbp_has_replies, WP_Query->__construct, WP_Query->query, WP_Query->get_posts
Is this helpful?
Yes, I’ve switched to 2024 theme AND deactivated all plugs, one-by-one. Same error.
Oh… Wait… I read that wrong, didn’t I? Oops… so ALL topics and replies ARE paired with their respective post_parent key values. Nothing is wrong with the DB, so the question still remains: WHY is BBP unable to find post_parent key in the front end, but can in the back?
I installed and ran Robin’s Fix Import plugin from this thread: https://bbpress.org/forums/topic/topics-and-replies-not-showing-after-import/
The results:
Topics fixed…
Replies fixed…
All done….
Total topics: 106
Topics with no post_parent: 0
Topics with no parent in post meta: 0
Total replies: 663
Replies with no post_parent: 0
Replies with no parent in post meta: 0I do not see how this is possible. I’m looking at the database wp_posts and selecting by post_type = replies (and then topics) in phpMyAdmin. The post_parent key for post_type = replies has values matching the post_parent key value for each post_type = topic, AND the post_parent key value matches the ID key value for post_type = forum. Wherein does this warrant a finding of ZERO posts/replies?
What is perplexing is that in the backend sidebar menu > Topic, ALL the OP topic posts are listed and open up for viewing/editing in the Edit page. SAME for the Replies menu.
So, since the backend works, why is the frontend NOT showing the OP and reply posts? Why is BBP saying it can’t FIND the post_parent key when it appears it can in the backend?
I never knew those tools were there! Thanks.
However, running each one individually did not fix the [Key ‘post_parent’ doesn’t exist in table ‘wp_posts’] error. Ugh.
Probably because none of the repair descriptions match the situation at hand, eg. “run this if topic replies do not display.”
The error “looks” like some sort of permissions thing, because, again, “post_parent” DOES exist.
Ugh. No editing of posts? Crazy. Anyway… forgot to select the error along with the query…. WordPress database error: [Key ‘post_parent’ doesn’t exist in table ‘wp_posts’]
Like I said, ‘post_parent’ most certainly DOES EXIST! per copy/paste below from myPHPAdmin…
1 ID Primary AUTO_INCREMENT
2 post_author
3 post_date
4 post_date_gmt
5 post_content
6 post_title
7 post_excerpt
8 post_status
9 comment_status
10 ping_status
11 post_password
12 post_name
13 to_ping
14 pinged text
15 post_modified
16 post_modified_gmt
17 post_content_filtered
18 post_parent bigint(20) UNSIGNED
19 guid
20 menu_order
21 post_type
22 post_mime_type
23 comment_count