Tag Info

New answers tagged

1

I would suggest querying a list of all post types using get_post_types. With that array you can do a foreach. and for each post type, query all terms with get_term. It would look something like this, but you should pass get_post_types your know post types, because as it stands, this will also display things like attachments and nav menus. function ...


0

The main problem is that, in your $_POST loop, $value is an array, yet you apply htmlspecialchars to it, which will vomit and return back nothing. If you haven't done so already, set WP_DEBUG to true in your wp-config.php - developing without it is simply not an option. Regardless, let's fix that dirty $_POST loop: $tax_query = array(); // Don't need ...


1

I think you are running into trouble with these lines in wp_update_term(): 3287 // Merge old and new args with new args overwriting old ones. 3288 $args = array_merge($term, $args); https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/taxonomy.php#L3287 The array passed in gets merged with the data already in the DB. ...


0

Great question and solid answers. I really liked the approach by @jessica using the terms_clauses filter, because it extends the get_terms function in a very reasonable way. My code is a continuation of her idea, with some sql from @braydon to reduce duplicates. It also allows for an array of post_types: /** * my_terms_clauses * * filter the terms ...


0

try init instead of after_setup_theme function example_insert_category() { wp_insert_term( 'Example Category', 'friendsof' ); } add_action( 'init', 'example_insert_category' );


0

Use the Switch statement. switch ($term->name) { case 'customtermincustomtaxonomy': // ... break; case 'anotherterm': // ... break; case 'somethingelse': // ... break; }


1

Actually it does. ["term_id"]=> int(8) So the value is an integer 8.


0

Did you try adding a count callback? // Register Custom Taxonomy function custom_taxonomy() { $labels = array( 'name' => _x( 'Taxonomies', 'Taxonomy General Name', 'text_domain' ), 'singular_name' => _x( 'Taxonomy', 'Taxonomy Singular Name', 'text_domain' ), 'menu_name' ...



Top 50 recent answers are included