• Resolved kreestal

    (@kreestal)


    Hi!

    I’m using Custom Taxonomy Order NE v. 2.6.4, and WordPress 4.2.2.

    The plugin is working well, thanks a lot for sharing ??

    However I have one minor complaint. In my theme, I disabled post formats:

    remove_theme_support('post-formats');

    Despite this, the plugin keeps on adding an option to set up a custom order for formats… which is useless in my case. This menu item links to:

    https://myurl.com/wp-admin/admin.php?page=customtaxorder-post_format

    I don’t have any custom taxonomy which is called post_format, so this doesn’t come from my code.

    I believe this custom sorting option shouldn’t appear when the theme doesn’t support post-formats.

    Subsidiary question: is it possible to disable the custom sorting for any taxonomy? For example, what if I want to disable to possibility to set a custom sorting order to categories or tags?

    This would also let me disable the post-formats’.

    Thanks for your help ??

    https://www.ads-software.com/plugins/custom-taxonomy-order-ne/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marcel Pol

    (@mpol)

    Hi, interesting question ??

    The point is that the plugin shows all taxonomies that are set to public. The builtin ones are set to public in WP-core.

    You can however overwrite that, by just registering them again, this time with public set to false. It needs to happen in the init action, but with a late priority. Use it like this (works for me). It has been cut-and-pasted from wp-includes/taxonomy.php, with only public set to false.

    add_action( 'init', 'i_like_disco', 12 );
    function i_like_disco() {
    
    	global $wp_rewrite;
    
    	$rewrite = array( 'category' => false, 'post_tag' => false, 'post_format' => false );
    
    		/**
    		 * Filter the post formats rewrite base.
    		 *
    		 * @since 3.1.0
    		 *
    		 * @param string $context Context of the rewrite base. Default 'type'.
    		 */
    		$post_format_base = apply_filters( 'post_format_rewrite_base', 'type' );
    		$rewrite = array(
    			'category' => array(
    				'hierarchical' => true,
    				'slug' => get_option('category_base') ? get_option('category_base') : 'category',
    				'with_front' => ! get_option('category_base') || $wp_rewrite->using_index_permalinks(),
    				'ep_mask' => EP_CATEGORIES,
    			),
    			'post_tag' => array(
    				'hierarchical' => false,
    				'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
    				'with_front' => ! get_option('tag_base') || $wp_rewrite->using_index_permalinks(),
    				'ep_mask' => EP_TAGS,
    			),
    			'post_format' => $post_format_base ? array( 'slug' => $post_format_base ) : false,
    		);
    
    	register_taxonomy( 'category', 'post', array(
    		'hierarchical' => true,
    		'query_var' => 'category_name',
    		'rewrite' => $rewrite['category'],
    		'public' => false,
    		'show_ui' => true,
    		'show_admin_column' => true,
    		'_builtin' => true,
    	) );
    
    	register_taxonomy( 'post_tag', 'post', array(
    	 	'hierarchical' => false,
    		'query_var' => 'tag',
    		'rewrite' => $rewrite['post_tag'],
    		'public' => false,
    		'show_ui' => true,
    		'show_admin_column' => true,
    		'_builtin' => true,
    	) );
    
    	register_taxonomy( 'post_format', 'post', array(
    		'public' => false,
    		'hierarchical' => false,
    		'labels' => array(
    			'name' => _x( 'Format', 'post format' ),
    			'singular_name' => _x( 'Format', 'post format' ),
    		),
    		'query_var' => true,
    		'rewrite' => $rewrite['post_format'],
    		'show_ui' => false,
    		'_builtin' => true,
    		'show_in_nav_menus' => current_theme_supports( 'post-formats' ),
    	) );
    
    }
    Thread Starter kreestal

    (@kreestal)

    Thanks a lot for your reply Marcel!

    I’m not comfortable with copying a core function in my theme, though.

    Plugin Author Marcel Pol

    (@mpol)

    It should be safe. It is not a function you overwrite, but the builtin taxonomies.
    But you do have to be aware that when setting public to false, that the archives pages are disabled then.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post formats disabled, still the plugin's menu option appears’ is closed to new replies.