Can I turn off write-in tags/taxonomies?

Here is what I came up with, seems to work: add_filter( ‘pre_post_tags_input’, ‘no_tags_input_create’ ); add_filter( ‘pre_post_tax_input’, ‘no_tax_input_create’ ); function no_tags_input_create($tags_input) { $output = array(); foreach( $tags_input as $tag ) if( term_exists( $tag, ‘post_tag’) ) $output[] = $tag; return $output; } function no_tax_input_create($tax_input) { if( !isset($tax_input[‘post_tag’]) ) return $tax_input; $output = array(); $tags = explode(‘,’, $tax_input[‘post_tag’]); … Read more

Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)

should it be.. $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; WP_Query in codex: Pagination Note: You should set get_query_var( ‘page’ ); if you want your query to work with pagination. Since WordPress 3.0.2, you do get_query_var( ‘page’ ) instead of get_query_var( ‘paged’ ). The pagination parameter ‘paged’ for WP_Query() remains the same.

How To Change Custom Taxonomy To Radio Buttons

hope it isn’t considered overly self-promotional, but i’ve turned stephen harris’ code into a plugin that will do this for you: http://wordpress.org/extend/plugins/radio-buttons-for-taxonomies/ i’m still working on getting the quick edit to show radio buttons too, but that appears to be significantly harder.

Creating a non-removable taxonomy term

Update Indeed, there is a way to define one term per taxonomy as default term which makes it non-deletable from the admin GUI. WP_Terms_List_Table looks for an option get_option( ‘default_’ . $this->screen->taxonomy ). So if you have a custom Taxonomy called genre, you have to set an option default_genre with the term-id of the term … Read more

Custom taxonomy hide meta box but show in menu

You’re looking for the meta_box_cb argument. $args = array( ‘hierarchical’ => true, ‘labels’ => $labels, ‘show_ui’ => false, ‘show_admin_column’ => false, ‘show_in_menu’ => true, ‘show_in_nav_menus’ => true, ‘query_var’ => true, ‘rewrite’ => array( ‘slug’ => ‘wheel’ ), ‘meta_box_cb’ => false, ); register_taxonomy( ‘wheel’, array( ‘product’ ), $args ); You can also define a custom callback … Read more

get_term_by not working when in functions.php

This is probably happening because the taxonomy you’re trying to query is registered yet. Eg. The WordPress environment is loaded when a theme’s functions.php file loads, but many plugins/themes/core functions don’t register taxonomies until later. Try hooking into init with a really high priority number and running the get_term_by function. Like so: <?php add_action( ‘init’, … Read more

Order terms by term_order

As this is one of the top results on Google and none of the above quite worked for me, this did seem to return terms in an order matching their display in the admin… get_terms([ ‘taxonomy’ => ‘whatever_you_want’, ‘meta_key’ => ‘order’, ‘orderby’ => ‘meta_value_num’ ]); In case it helps anyone, WP stores a value in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)