WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 months ago

#37916 new enhancement

Customize: ability to disable content creation in menus

Reported by: celloexpressions Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: needs-patch
Focuses: Cc:

Description

There should be a hook to disable the ability to create new posts (and eventually terms, see #37915) in nav menus in the customizer. Ideally, it should be able to be disabled for specific post types as well as all post types. For terms, we'll need to turn it off for the post_format taxonomy.

This is being split out from the initial merge in #34923, where there are patches with an approach we could take here.

Attachments (2)

37916.diff (2.6 KB) - added by jorbin 3 years ago.
37916.2.diff (1.3 KB) - added by jorbin 3 years ago.

Download all attachments as: .zip

Change History (11)

This ticket was mentioned in Slack in #core-customize by celloexpressions. View the logs.


3 years ago

This ticket was mentioned in Slack in #core-customize by celloexpressions. View the logs.


3 years ago

#3 @jorbin
3 years ago

@celloexpressions Now that #34923 has been committed, is this something you want to revist?

#4 @celloexpressions
3 years ago

@jorbin this was created after that commit :) Still waiting for dev feedback here, if you have any, please provide.

We're kind of waiting for #37914 as term support might change the approach here. My preference would still be to have something that can work for both post and term objects, though, and filters an array that contains only taxonomy_post_format as a disallowed type by default. Passing __return_false to that filter would disable the feature for all post types and taxonomies.

#5 @jorbin
3 years ago

@celloexpressions totally missed the timing :) sorry about that.

I'm considerably less familiar with the customizor code, so I would likely defer to you or @westonruter, but perhaps a filter that is in ajax_insert_auto_draft_post and whatever handler is used for taxonomies who's value is also output as a JS var that can be used to decide if we should show the add new box and button?

Last edited 3 years ago by jorbin (previous) (diff)

@jorbin
3 years ago

#6 @jorbin
3 years ago

Above patch is a proof of concept of my idea.

@jorbin
3 years ago

#7 @jorbin
3 years ago

This time without another patch I was testing :)

#8 @westonruter
3 years ago

  • Keywords dev-feedback removed
  • Milestone changed from 4.7 to Future Release

I don't think we currently *need* a way to turn off the ability to create stubs for nav menu items. Since the post_format taxonomy is the only known use case for needing to turn off stub creation, and since term stubs aren't going to be part of 4.7 (per #37915) I think we can punt this to Future Release.

And the ticket isn't about turning off stub creation _entirely_ but rather turning off stub creation for specific object types. So in 37916.2.diff the customize_create_nav_menu_content filter would need to be amended with additional context for the specific post_type or taxonomy.

#11 @celloexpressions
5 months ago

  • Milestone set to Future Release

This still blocks #37915, which is still valid and needed but more-significantly blocked by #37914.

This ticket can be resolved in the meantime to eliminate a blocker for #37915. The next step is to revise 37916.2.diff based on the feedback in 8.

Note: See TracTickets for help on using tickets.