WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 17 months ago

#39592 new defect (bug)

Recent posts widget doesn't filter post types properly

Reported by: noccy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.1
Component: Widgets Keywords: reporter-feedback
Focuses: Cc:

Description

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.

Change History (2)

#1 follow-up: @SergeyBiryukov
17 months ago

  • Keywords reporter-feedback added

Hi @noccy, welcome to Trac! Thanks for the report.

Does it still happen with all plugins disabled and a default theme (Twenty Seventeen or Twenty Sixteen) activated?

#2 in reply to: ↑ 1 @noccy
17 months ago

Replying to SergeyBiryukov:

Does it still happen with all plugins disabled and a default theme (Twenty Seventeen or Twenty Sixteen) activated?

I'm using Twenty Seventeen as my main theme. I tried disabling all plugins and enabled them one at a time, and it seems that Download Manager might have got something to do with it. Let me know if you need any more information.

Note: See TracTickets for help on using tickets.