[wp-trac] [WordPress Trac] #39592: Recent posts widget doesn't filter post types properly
WordPress Trac
noreply at wordpress.org
Sun Jan 15 13:34:47 UTC 2017
#39592: Recent posts widget doesn't filter post types properly
--------------------------+-----------------------------
Reporter: noccy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 4.7.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When browsing by a tag f.ex. `/tag/books/`the Recent Posts widget is
showing some really weird items alongside the actual posts. On my personal
site, one is called ''Home'' but with a link for `/2016/12/30/home-2`
(which is broken), and the next few are simply named ''752'', ''751'' and
''750'', again leading to `/2016/12/30/75x` (which are all broken).
Looking in the database, these are not posts but rather have post_type
`nav_menu_item`:
{{{
mysql> SELECT ID,post_date,post_type,post_name FROM blog_posts WHERE
post_name='home-2' \G
*************************** 1. row ***************************
ID: 761
post_date: 2016-12-30 17:36:22
post_type: nav_menu_item
post_name: home-2
1 row in set (0.00 sec)
}}}
''(I'm only showing one record here, but they all have the same post
type)''
I posted this on the wordpress.com support forums, but without getting an
answer. So I went on to try and edit the source for the recent posts
widget in order to apply an explicit filter, but this didn't fix the
problem either.
I have also tried using other recent posts widget plugins, but they all
suffer the same problem. So while this likely has to do with the internals
of WP_Query and the filtering code, I'm submitting this under component
''Widgets'' as it is only the widgets that seem to break.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39592>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list