Notice: Trying to get property of non-object in : custom fields category

Most probably the term was not found and $current_term returned as false: $current_term = get_term_by( ‘slug’, $term_slug, $taxonomyName ); $term_id = false === $current_term->term_id ? null : $current_term->term_id; According to the docs, get_term_by() return values are Term Row (object or array) from database. Will return false if $taxonomy does not exist or $term was not … Read more

Get object for a few selected taxonomies

I am not aware of a function to get only specific term objects for a post type but it is not hard to filter out the ones you want. For example: $taxonomies = get_object_taxonomies( ‘post’, ‘objects’ ); $taxonomies = array_intersect_key($taxonomies,array_flip(array(‘category’,’post_tag’))); var_dump($taxonomies); But since you know the taxonomies you want, you could also just use get_taxonomy( … Read more

Hide meta box for everything BUT a certain custom post type

Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? http://codex.wordpress.org/Function_Reference/register_taxonomy register_taxonomy( ‘my_custom_post_type_tags’, ‘my_custom_post_type’, array( ‘label’ => __( ‘Tags’ ), ‘rewrite’ => false, ‘hierarchical’ => false, ‘capabilities’ => array( ‘edit_terms’ => ‘manage_categories’ ) ) );

Displaying Custom Taxonomy without a hyperlink

Use get_the_terms instead of the_terms. http://codex.wordpress.org/Function_Reference/get_the_terms Something like this should do the trick: $terms = get_the_terms( get_the_ID(), ‘ehp_volumes’ ); $term_count = count( $terms ); if ( $term_count > 0 && ! wp_error( $terms ) ) { $terms = array_values( $terms ); // reset keys for easier looping. by default the key matches the term id … Read more

Filter second dropdown (tax) based on first dropdown (cpt)

If you want an example of how to do the dropdown filtering using ajax, then if you factor out your taxonomy dropdown into your “functions.php”: function my_dropdown_categories( $taxonomy, $current_selected = ”, $include = null ) { // Get all terms of the chosen taxonomy $terms = get_terms($taxonomy, array(‘orderby’ => ‘name’)); // our content variable $list_of_terms=”<select … Read more

Taxonomy – Exclude post format from showing on page

If you’re trying to hide a post-format on one particular page, then the function below should work. <?php // Exclude post-format from one particular page function exclude_campaigns( $query ) { // is_page() allows for page ID, page title or page slug if( $query->is_main_query() && $query->is_page( INSERT_PAGE_ID_HERE ) ) { $tax_query = array( ‘taxonomy’ => ‘post_format’, … Read more