How to remove comment count column in Posts inside the admin dashboard?

Should be work, if you use the filter manage_posts_columns. The hook is fine, see https://core.trac.wordpress.org/browser/tags/5.8/src/wp-admin/includes/class-wp-posts-list-table.php#L714 Documentation include examples – https://developer.wordpress.org/reference/hooks/manage_posts_columns/ Example: function remove_posts_columns( $columns, ‘post’ ) { unset( $columns[‘comments’] ); return $columns; } add_filter( ‘manage_posts_columns’, ‘remove_posts_columns’, 10, 2 );

If ACF field is empty show different value [closed]

This is basically a php question. add_filter( ‘facetwp_map_marker_args’, function( $args, $post_id ) { $field = get_field( ‘Type’, $post_id ); // Get this post’s ACF value $tent=”tent”; if( !$field ){ $field = $tent; } $args[‘icon’] = ‘https://www.muddycamper.com/wp-content/themes/oceanwp-child-theme-muddy-camper/images/markers/’ . $field . ‘.png’; return $args; }, 10, 2 ); You could do it your way as well, but … Read more

Use html inside shortcode function

There are several things you need to know, after which the problems become obvious: you join strings together using . for example ‘hello’ . ‘world’ is the same as ‘helloworld’ You end a statement/action/call with ;, this is you telling PHP that you have finished saying something, and you are going to say something new … Read more

Set Taxonomy based on post status

This is what works with the help of WebElaine above. I had to pass the postID to has_category() and then set variables. function add_categories_automatically($postID) { $p_published = get_post_status($postID) == ‘publish’; $p_draft = get_post_status($postID) == ‘draft’; $p_cat = has_category( ‘billed’, $postID); if ($p_draft == ‘draft’){ $catsID = array(1); //active wp_set_post_categories($postID, $catsID); } if ($p_published == ‘publish’){ … Read more

How can I add a filter for specific categories on functions.php?

As pointed out in this answer, using the request filter means that some (if not all) of WordPress’s is_* functions are unavailable. Use the corresponding member functions of your new WP_Query instead, as they should be available. function graphene_alter_the_query( $request ) { $dummy_query = new WP_Query(); $dummy_query->parse_query( $request ); if ( ! $dummy_query->is_category( 25 )) … Read more