WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 months ago

#39592 closed defect (bug) (invalid)

Recent posts widget doesn't filter post types properly

Reported by: noccy Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.1
Component: Widgets Keywords: reporter-feedback close
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 (4)

#1 follow-up: @SergeyBiryukov
4 years 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
4 years 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.

#3 @hellofromTonya
4 months ago

  • Keywords close added

Hello @noccy,

Does this issue persist today? In reading the last comment, you note that the issue seemed to be due to the Download Manager plugin. With that plugin and all others deactivated, was the problem resolved?

For now, I'm marking this ticket as a close candidate. Why? It is likely due to a plugin, rather than due to WordPress Core.

#4 @hellofromTonya
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Closing this ticket. However, if the problem persists, please reopen and provide more information to help us further investigate.

Note: See TracTickets for help on using tickets.