WordPress built-in method to extract array of term IDs?

I know you’ve long since solved this, but wanted to offer another solution. This question popped up as “related” when I was answering another one. You can use the WordPress function wp_list_pluck to return an array with values as one of the fields of the array or objects sent to the function. In other words, … Read more

Custom Taxonomy leads to 404 page

You can add flush_rewrite_rules() after registering your custom taxonomy. NOTE: Flush rules only on activation or deactivation, or when you know that the rewrite rules need to be changed. Don’t do it on any hook that will triggered on a routine basis. More detail information in the comments on WP Engineer’s post: Custom Post Type … Read more

Manually query posts by taxonomy with MySQL

This worked fine for me. The postmeta inclusion might be a bit messy. Without it, I got about 150 results. With it, I got over 5000. I never go an empty result. Since postmeta will have anywhere from zero to hundreds of items per post, it is going to make a new row for every … Read more

Organising Taxonomy categories

By what criterion do you need to order your taxonomy terms? See this argument-array key: ‘orderby’ => $orderby, Per the documentation for wp_list_categories(), the orderby parameter can take the following values: ‘ID’ – Default ‘name’ ‘slug’ ‘count’ ‘term_group’ Note, you may also want to add the order parameter: ‘orderby’ => ‘ASC’, This parameter takes: ‘ASC’ … Read more

Getting the parent from the wp_term_taxonomy

My experience with this was that it is an issue area of the taxonomy system in core. In several cases the core code does fetch info based on a tt_id or an array of them, but in each of these cases it is painfully done with a custom SQL query inside that particular function rather … Read more

Filter taxonomy terms using multiple id in the edit-tags.php

It’s easy to implement. All you need is your own hook for get_terms_args filter: add_filter( ‘get_terms_args’, ‘wpse8170_get_terms_args’, 10, 2 ); function wpse8170_get_terms_args( $args, $taxonomies ) { if ( !in_array( ‘post_tag’, $taxonomies ) ) { return $args; } $matches = array(); if ( empty( $args[‘search’] ) || !preg_match( ‘/^\#(.*)$/’, $args[‘search’], $matches ) ) { return $args; … Read more

How to make checkboxes from taxonomy terms?

$taxonomy = ‘training_cats’; $orderby = ‘name’; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 0; // 1 for yes, 0 for no $title=””; $empty = 0; $args = array( ‘name’ => $taxonomy, ‘orderby’ => $orderby, ‘show_count’ => $show_count, ‘pad_counts’ => $pad_counts, … Read more

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