Opened 14 years ago
Closed 14 years ago
#22360 closed defect (bug) (duplicate)
Database Error with previous_post_link and next_post_link functions
| Reported by: | neonwired | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Template | Version: | 3.4.2 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
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
@
14 years ago
The SQL is invalid due to missing term IDs in AND tt.term_id IN (). Not sure how this happened.
#3
@
14 years ago
This may only effect custom post type will confirm if this is the case.
#4
@
14 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Could not reproduce neither in 3.4.2 with Twenty Eleven nor in 3.5-beta2 with Twenty Twelve.
My steps:
single.php, addtrueto theprevious_post_link()andnext_post_link()calls:Could you provide some steps to reproduce the issue on a clean install?