Opened 12 years ago
Closed 12 years ago
#22360 closed defect (bug) (duplicate)
Database Error with previous_post_link and next_post_link functions
Reported by: | neonwired | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.2 |
Component: | Template | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Passing a value of 1 or true for the in_same_cat argument results in a database 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 ') WHERE p.post_date < '2012-10-14 17:16:13' AND p.post_type = 'project' AND p.po' at line 1]
SELECT p.* FROM wp_posts AS p INNER JOIN wp_term_relationships AS tr ON p.ID = tr.object_id INNER JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id AND tt.taxonomy = 'category' AND tt.term_id IN () WHERE p.post_date < '2012-10-14 17:16:13' AND p.post_type = 'project' AND p.post_status = 'publish' AND tt.taxonomy = 'category' ORDER BY p.post_date DESC LIMIT 1
Attachments (1)
Change History (8)
#2
@
12 years ago
The SQL is invalid due to missing term IDs in AND tt.term_id IN ()
. Not sure how this happened.
#3
@
12 years ago
This may only effect custom post types which obviously have custom taxonomies not categories. Will confirm if this is the case. No clues in the ref docs whether this is intended to work with custom post types.
#4
@
12 years ago
Tested it by adding a custom post type to the twenty eleven theme, no other edits, all plugins disabled still results in the same database error.
Could not reproduce neither in 3.4.2 with Twenty Eleven nor in 3.5-beta2 with Twenty Twelve.
My steps:
single.php
, addtrue
to theprevious_post_link()
andnext_post_link()
calls:Could you provide some steps to reproduce the issue on a clean install?