Tag Info

Hot answers tagged

3

When user starts typing something into tag input, JavaScript makes request to admin-ajax.php with action set to ajax-tag-search to receive list of suggestions (if any). In that file that action is recognized as belonging to core and wp_ajax_tag_search() function is added to dynamically generated wp_ajax_ajax-tag-search hook, which fires almost immediately ...


3

Tax Query Limits A Taxonomy Query in WordPress supports the following three arguments for the operator parameter: IN, NOT IN and AND. So it basically can't do what you're trying to do. Not even with advanced (tax_query) Queries. Meta Query and possibilities You'll want to move your concept a bit and work with post meta fields/data. The WP_Query uses the ...


2

Take a look at the Codex: taxonomy-{taxonomy}-{term}.php - If the taxonomy were sometax, and taxonomy's term were someterm WordPress would look for taxonomy-sometax-someterm.php. In the case of Post Formats, the taxonomy is 'post_format' and the terms are post-format-{format}. i.e. taxonomy-post_format-post-format-link.php ...


2

It was a long way around to get there but you basically have a markup error. You didn't name your select. You should have: <select id="select-taxonomy" name="<?php echo $name ?>"> // <-- here is the change <?php foreach($terms as $term) { $id = $taxonomy.'-'.$term->term_id; $value= (is_taxonomy_hierarchical($taxonomy) ? ...


2

To get a list of all terms of taxonomy X whose posts are associated to terms from taxonomy Y too, we have to: Get all term IDs for both taxonomies Create a tax query to fetch all posts, because we don’t want to show empty term archives. Format the result in a hierarchical list. Let’s go! Getting the term IDs is simple: get_terms( $taxonomy_name, ...


2

What is happening is that: the page /wp-admin/edit-tags.php uses $_GET['taxonomy'] and /wp-admin/admin-ajax.php, fired when we create a new term, uses $_POST['taxonomy'] To solve it, use $_REQUEST in manage_my_category_columns(). It will cover both GET and POST: if ( !isset( $_REQUEST['taxonomy']) || $_REQUEST['taxonomy'] != 'products' ) Related ...


1

For terms and taxonomies use get_term_feed_link: "Returns a link to the feed for all posts in a given term. A specific feed can be requested or left blank to get the default feed." See also get_tag_feed_link and get_category_feed_link. For post types see get_post_type_archive_feed_link. These functions are located in in ...


1

Filter pre_get_posts: add_filter( 'pre_get_posts', 'wpse_98213_add_post_types_to_tax_query' ); /** * Let WP search for custom post types on taxonomy archives. * * @wp-hook pre_get_posts * @param object $query * @return object */ function wpse_98213_add_post_types_to_tax_query( $query ) { if ( ! is_main_query() or ! is_tax( 'your_taxonomy_name' ...


1

Since wp_set_post_terms() does not accept hierarchy for it, you will first have to check if terms exist already, create them using wp_insert_term() if not and only then assign to post. Note that there had been (don't know current state) some cache related bugs with doing such things on the fly, see Inserting terms in an Hierarchical Taxonomy


1

It's because within wp_insert_post current user capabilities are checked before adding the terms: if ( current_user_can($taxonomy_obj->cap->assign_terms) ) wp_set_post_terms( $post_ID, $tags, $taxonomy ); to get around this, use wp_set_object_terms instead after wp_insert_post to add the terms: $new_post = array( 'post_title' => ...


1

You can also use a custom walker for wp_list_categories(). That is a custom class extending Walker_Category. In that class you can change anything, including the list item ends. Sample class class Extended_Walker_Category extends Walker_Category { function end_el( &$output, $page, $depth = 0, $args = array() ) { if ( 'list' != ...


1

Use get_categories() (which returns an array of category objects rather than directly displaying them) instead of wp_list_categories, and loop through the results, outputting whatever you want.


1

I could not find a built-in way to accomplish this solution, but I have created a workaround I realized, if the menu won't stay open, why not open it myself? I created the following two functions, which are easy enough to understand. They need to be called in a javascript file which is loaded via admin script (see the function wp_enqueue_script and the ...


1

I realise this is a very old question, but if you have a need to build up an actual structure of terms, this might be a useful method for you: /** * Recursively sort an array of taxonomy terms hierarchically. Child categories will be * placed under a 'children' member of their parent term. * @param Array $cats taxonomy term objects to sort * ...



Only top voted, non community-wiki answers of a minimum length are eligible