WP_safe_redirect not working

Your action callback probably gets called, but it could be that the if-statement that just fails. Are you using the default “category” taxonomy (i.e. Dashboard > Posts > Categories) or a custom taxonomy (i.e. Dashboard > {my-post-type} > {my-taxonomy}) as the project category? If you’re using a custom taxonomy, then you should use is_tax(‘my-taxonomy’) instead … Read more

How can I display tags as categories?

If you can setup url query parameters and when user navigates to tagfillterPage page with wp_query it should work. https://examples.com/tagfillterPage/?filltertag=tagname $querytag = $_GET[‘filltertag’]; $args = array( ‘tag’ => $querytag ); // Custom query. $query = new WP_Query( $args ); // Check that we have query results. if ( $query->have_posts() ) { // Start looping over … Read more

Why title_li =” not working

Because the parameter name is title_li and not title_li=. It also doesn’t make sense of using __( ” ), so I’d change that to just ”. // When the args is a query string, title_li= works. $args=”title_li=”; // But when the args is an array, use just title_li. $args = array( ‘title_li=’ => ”, // … Read more

wp_list_categories walker without links on categories that have subcategories (to make a nested dropdown menu)

If you say the wp_list_categories output format is ok to you and all you need is only to remove the links from parent categories, try the following code (you can add it to your functions.php): add_filter( ‘wp_list_categories’, ‘sanitize_list_categories_links’, 10, 2 ); function sanitize_list_categories_links( $list, $args ) { if ( isset( $args[‘sanitize_links’] ) && $args[‘sanitize_links’] ) … Read more

How to show the category of custom taxonomy

Usually I used has_term() and the_terms(). These are the examples if( has_term(”, ‘genre’) ){ // do something } the_terms( $post->ID, ‘category’, ‘categories: ‘, “https://wordpress.stackexchange.com/” ); OR, I used this to get a list get_the_term_list() for example echo get_the_term_list($post->ID, ‘category’, ”, ‘, ‘);

Count tags for a specific category

count how many posts are tagged but only include those posts that belong to a specific category You can’t do that via get_terms(), but you can make a WP_Query query and use the $found_posts property to get the total posts. So for example, in your foreach, you can use the tag and cat parameters like … Read more

How to loop custom post_type from (a) specific category(ies)?

This is my loop, try using it. <!– Post –> <?php $paged= (get_query_var(‘paged’ )) ? get_query_var(‘paged’):1; global $query_string; $myquery = wp_parse_args($query_string); $myquery = array( ‘paged’ => $paged, ‘posts_per_page’=>6, ‘post_type’ => ‘portfolio’. ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘terms’ => array(‘picture’), ‘field’ => ‘slug’, ), ), ); query_posts($myquery); while ( have_posts() ) … Read more

If x comments in a post move post to category y

You could use the wp_insert_comment action to detect when new comments are added to a post. Then on your action callback, you’d the post’s comment count with get_comments_number(), and change post categories with wp_set_object_terms(). Something along these lines, add_filter( ‘wp_insert_comment’, function($id, $comment) { if ( (int) $comment->comment_approved ) { $post_id = (int) $comment->comment_post_ID; $post_comment_count = … Read more