Avoiding stripping of HTML in Custom Taxonomy Meta Field

you can use esc_attr function save_taxonomy_custom_meta_bandcamp_embed_music( $term_id ) { if ( isset( $_POST[‘term_meta’] ) ) { $t_id = $term_id; $term_meta = get_option( “taxonomy_$t_id” ); $cat_keys = array_keys( $_POST[‘term_meta’] ); foreach ( $cat_keys as $key ) { if ( isset ( $_POST[‘term_meta’][$key] ) ) { $term_meta[$key] = esc_attr( $_POST[‘term_meta’][$key] ); // encoded text with HTML entities … Read more

Listing all selected terms for custom taxonomies on a post

$args = array( ‘post_type’ => ‘inspirations’, ‘posts_per_page’ => 10 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); $collections=””; foreach ( (array) wp_get_post_terms( get_the_ID(), ‘collections’) as $collection ) { if ( empty($collection->slug ) ) continue; $collections .= ‘ collection-‘ . sanitize_html_class($collection->slug, $collection->term_id); } echo ‘<div class=”inspirations-post ‘. $collections . ‘”>’; the_title(); … Read more

title tag for custom post type remove taxonomy name from title tag

I believe that WPPizza Categories is coming from ‘name’ => _x( ‘WPPizza Categories’, ‘taxonomy general name’ ) And your url problem is coming from not setting a slug. For example: ‘rewrite’ => array( ‘slug’ => ‘pizza_categories’, ‘with_front’ => false ), You need to replace the slug with something else, as you need something in place … Read more

get_terms returns array starting at 4

Run get_terms like this: var_dump(get_terms(‘category’,array(‘hide_empty’=>false))); And then like this: var_dump(get_terms(‘category’)); You should be able to infer what is happening. The first should return the zero based array you expect, with neatly numbered keys. The second does not. The only difference being the hide_empty argument. If you really must have a zero based array just pass … Read more