Get value in custom field with taxonomy [closed]

I can’t really explain it any better than the ACF documentation page I posted in the comments: All the API functions can be used with a taxonomy term, however, a second parameter is required to target the term ID. This is similar to passing through a post_id to target a specific post object. The $post_id … Read more

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.

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

How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?

The pre_get_posts filter is immediately before the loop begins in taxonomy-services.php That is too late. The main query runs long before your template loads. Move your pre_get_posts filter to your theme’s functions.php, or a plugin or MU-Plugin file, and you should see the difference.

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