• Hello Folks

    We have used co-author-plus in our previous site. Later on we have exported and imported all the users IN new site then we have imported all the blog post in the new site. After that we have installed co-author plus. But after that we just realized that in the admin post count for the users is 0 and on frontend some of our users are facing SQL error.

    When we disabled this then all the post count are seems fine.

    ERROR:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘4 OR (wp_term_taxonomy.taxonomy = ‘author’ AND wp_term_taxonomy.term_id = ‘11592’ at line 1]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships AS tr1 ON (wp_posts.ID = tr1.object_id) LEFT JOIN wp_term_taxonomy ON ( tr1.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id ) WHERE 1=1 AND ((wp_term_taxonomy.taxonomy = ‘author’ AND wp_term_taxonomy.term_id = ‘11176’4 OR (wp_term_taxonomy.taxonomy = ‘author’ AND wp_term_taxonomy.term_id = ‘11592’))) AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_status = ‘archive’ OR wp_posts.post_status = ‘unlist’ OR wp_posts.post_status = ‘private’ OR wp_posts.post_status = ‘archive’ OR wp_posts.post_status = ‘unlist’) GROUP BY wp_posts.ID HAVING MAX( IF ( wp_term_taxonomy.taxonomy = ‘author’, IF ( wp_term_taxonomy.term_id = ‘11592’ OR wp_term_taxonomy.term_id = ‘11176’,2,1 ),0 ) ) <> 1 ORDER BY wp_posts.post_date DESC LIMIT 0, 9 /* From [blogs/author/authorname/] in [index.php:17] */

Viewing 2 replies - 1 through 2 (of 2 total)
  • Co-author-plus
    Hi,
    I have a similar error. For examples, I have 2 posts with the author 29. For one the user 29 is the first author, for the author, it’s the second one.
    I want to display in the admin only the posts of the current author, two posts for the example.
    With a filter of pre_get_posts ($query->set(‘author’, $user_ID ), only the first post is displayed. I get the impression that the filter ‘posts_where_filter’ is not called.

    With an admin account, the URL …/wp-admin/edit.php?author=29 works fine, the two posts are displayed. But with an author account (with this id 29), there’s no result.

    Here’s the SQL where clause line 718 in function posts_where_filter:
    AND ( wp_3_posts.post_author IN (29) AND wp_3_posts.post_type = ‘post’ AND (wp_3_posts.post_status = ‘publish’ OR wp_3_posts.post_status = ‘acf-disabled’ OR wp_3_posts.post_status = ‘refunded’ OR wp_3_posts.post_status = ‘failed’ OR wp_3_posts.post_status = ‘revoked’ OR wp_3_posts.post_status = ‘cancelled’ OR wp_3_posts.post_status = ‘abandoned’ OR wp_3_posts.post_status = ‘processing’ OR wp_3_posts.post_status = ‘preapproval’ OR wp_3_posts.post_status = ‘future’ OR wp_3_posts.post_status = ‘draft’ OR wp_3_posts.post_status = ‘pending’ OR wp_3_posts.post_author = 29 OR (wp_3_term_taxonomy.taxonomy = ‘author’ AND wp_3_term_taxonomy.term_id = ’11’))AND wp_3_posts.post_status = ‘private’)

    Thanks for help me.

    I have similar error with Co-Authors Plus 3.3.0 running on a multisite

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post count is 0 in admin and sometime error on author page’ is closed to new replies.