Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#14576 closed defect (bug) (invalid)

Nav Menu Item Description Duplicates Content

Reported by: jghazally Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords:
Focuses: Cc:


I noticed when playing around with WP3.0 Navigation on a clean install that when you add a page to the menu the page content gets duplicated in the nav_menu_item custom-post-type row for the navigation...
This caused issues with wp-e-commerce but was resolved through better query structuring. Just thought I should report it incase it was a genuine bug (does a menu item really need the content duplicated?
Attached was my attempt at a fix in nav-menu.php


Attachments (1)

wp_nav_menu.diff (1.3 KB) - added by jghazally 10 years ago.

Download all attachments as: .zip

Change History (4)

#1 @filosofo
10 years ago

Could you please provide some more information about the issue?

What is the problem with WP E-Commerce? Do you have links to relevant discussions?

Also, see #14415 which is related at least in the solution of not including the page content automatically.

#2 @jghazally
10 years ago

Hi @filosofo
essentially the SQL statement was badly written and is not restructured to suit, simply speaking WPEC was doing a (sudo code)

SELECT post_id FROM wp_posts WHERE content= '[shortcode]' LIMIT 1;

this was old code used for pulling out the ID for the products page to render the permalinks etc. however when 3.0 came out and people started to use the navigation and menu system and added the products-page to the menu, WP was adding a new row into wp_posts for the custom post type of nav_menu_item and duplicating the content... which was returning the wrong ID and failing to render permalinks...

As I said, WPEC has resolved the issue with better SQL statement, but thought I should report the issue incase it relates to other Plugins, Themes performance issues ..

#3 @nacin
10 years ago

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

You'll have to limit your query by post type. Ideally, if you use WP_Query, then you should be fine with regards to post types.

Note: See TracTickets for help on using tickets.