Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35324 closed defect (bug) (fixed)

Post Type Archives support in Nav Menus cannot read description

Reported by: mayukojpn's profile mayukojpn Owned by: jorbin's profile jorbin
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.4
Component: Menus Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Saved description data for post type archive nav menu items will be overwritten by empty.

This has been happend since #16075

Attachments (9)

Screenshot_2016_01_06_14_28.png (47.6 KB) - added by mayukojpn 9 years ago.
The words I added here and saved cannot read.
35324.patch (485 bytes) - added by mayukojpn 9 years ago.
Screenshot_2016_01_06_16_12.png (10.3 KB) - added by mayukojpn 9 years ago.
With this bug description field is also invalid on front.
35324-2.patch (2.2 KB) - added by Toro_Unit 9 years ago.
35324-3.patch (2.2 KB) - added by Toro_Unit 9 years ago.
35324-4.patch (2.3 KB) - added by Toro_Unit 9 years ago.
Add Support nav_menu_description filter.
35324-5.patch (1.6 KB) - added by mayukojpn 9 years ago.
35324-6.diff (1.6 KB) - added by mayukojpn 9 years ago.
last file was wrong file format, sorry!
35324.7.diff (2.0 KB) - added by bradyvercher 9 years ago.

Download all attachments as: .zip

Change History (24)

@mayukojpn
9 years ago

The words I added here and saved cannot read.

@mayukojpn
9 years ago

#1 @mayukojpn
9 years ago

  • Keywords has-patch added

#2 @mayukojpn
9 years ago

  • Version changed from trunk to 4.4

@mayukojpn
9 years ago

With this bug description field is also invalid on front.

#3 @johnbillion
9 years ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 4.5

#4 @Toro_Unit
9 years ago

to the description, post type description should be input by default.

Add new patch and Test.

Version 0, edited 9 years ago by Toro_Unit (next)

@Toro_Unit
9 years ago

@Toro_Unit
9 years ago

#5 @Toro_Unit
9 years ago

Sorry 35324-2.patch​ is broken. Please Try 34324-3.patch.

@Toro_Unit
9 years ago

Add Support nav_menu_description filter.

#6 @Toro_Unit
9 years ago

  • Keywords has-unit-tests added

#7 @mayukojpn
9 years ago

Thanks Toro_Unit for unit test!

I like your approach, but if CPT has own description, your function will overwrite menu item description even though I want to leave it empty.

Can we fix a bug this time and discuss it at new ticket?

@mayukojpn
9 years ago

@mayukojpn
9 years ago

last file was wrong file format, sorry!

#8 @extendwings
9 years ago

  • Keywords needs-testing removed

Tested 35324-6.diff with trunk, and works well.

#9 @ocean90
9 years ago

#35861 was marked as a duplicate.

#10 @mayukojpn
9 years ago

For anyone who is faced with this bug:
I made a plugin to fix this bug. Try this until the patch is merged.
https://gist.github.com/mayukojpn/6ef62c39dcf48c17ed96

#11 @jorbin
9 years ago

  • Owner set to jorbin
  • Status changed from new to assigned

#12 @jorbin
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 36859:

Ensure Description is respected in post type archive menu items.

Tested scenarios include: using the default (which is the post type description), Setting a custom description for that individual menu item, and setting a custom description that is blank. Introduced in r35382.

Props Toro_Unit, mayukojpn, extendwings, jorbin.
Fixes #35324. See #16075.

@bradyvercher
9 years ago

#13 @bradyvercher
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

36859 throws a notice when an archive menu item exists for a post type that is no longer registered. 35324.7.diff prevents the notice and adds a test for unregistered post types.

#14 @DrewAPicture
9 years ago

35324.7.diff looks good, thanks @bradyvercher.

#15 @DrewAPicture
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 36888:

Menus: Avoid a notice when outputting a description for an existing archive menu item for a post type that doesn't.

Props bradyvercher.
See [36859]. Fixes #35324.

Note: See TracTickets for help on using tickets.