[wp-trac] [WordPress Trac] #37915: Customize: allow terms to be created in nav menus
WordPress Trac
noreply at wordpress.org
Sun Sep 11 02:07:32 UTC 2016
#37915: Customize: allow terms to be created in nav menus
-------------------------------------+--------------------
Reporter: celloexpressions | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.7
Component: Customize | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch 2nd-opinion | Focuses:
-------------------------------------+--------------------
Changes (by boonebgorges):
* keywords: needs-patch => needs-patch 2nd-opinion
Comment:
Previously: https://core.trac.wordpress.org/ticket/34923#comment:46
Having thought a bit more about this, I agree with my former self (good
job, former self!) that the most feasible strategy for the time being is a
"shadow" taxonomy for each affected taxonomy. Very roughly, here's what
I'm imagining:
{{{
if ( is_customize_preview() || this is customize.php ) {
$menu_taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true
), 'objects' );
foreach ( $menu_taxonomies as $menu_tax_name => $menu_tax ) {
$shadow_tax_name = '_draft_' . $menu_tax_name;
$shadow_args = (array) $menu_tax;
$shadow_args['public'] = false;
$shadow_args['show_ui'] = false;
$shadow_args['show_in_menu'] = false;
$shadow_args['show_tagcloud'] = false;
// etc
register_taxonomy( $shadow_tax_name, $shadow_args['object_type'],
$shadow_args );
}
}
}}}
When customizing, save terms as '_draft_post_tag' etc, and when changes
are saved, delete the draft terms and publish them as actual terms.
Does this strategy seem workable and sane to you? (Keeping in mind that
"sane" is a relative term in this context.) Of the available options, it
seems to me like the one with the smallest footprint and the least
likelihood of interfering with (a) future improvements to the taxonomy
system, and (b) the various ways in which taxonomy terms are used - and
especially queried - in the wild.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37915#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list