How can I filter block registration based on post-type? (Block alignment settings)

I want to disable the .alignwide and .alignfull block alignment options (remove them from the editor UI) on the ‘post’ post-type only. I have tried using this block registration filter to modify the ‘supports’ attribute: function disablePostAlignwide( settings, name ) { if ( “post” != wp.data.select(‘core/editor’).getCurrentPostType() ) { return settings; } return lodash.assign( {}, settings, … Read more

Is it possible to request several post types from a feed?

If so, how should the query URL be formatted? I’ve tried: post_type=cat1&post_type=cat2 post_type=cat1,cat2 post_type=cat1+cat2 This bug report says you could use post_type[]=cat1&post_type[]=cat2 if not for the fact that “all request parameters are converted to strings”. Is this still the case and what does it mean? 1 Answer 1 You could use add_feed() and create new … Read more

How to output content based on same custom taxonomy?

I have been trying to output content of all post-types (Posts, Pages and CPTs) based on a term of a custom taxonomy that they must share (meaning if they don’t share that particular term, the output should not include that post-type). Here is what I have so far: $term_list = wp_get_post_terms($post->ID, ‘persons’, array(‘fields’ => ‘names’)); … Read more

wp_query for displaying attachments with a tag

So I am running the following query: <?php $args = new WP_Query(array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘oderby’ => ‘title’, ‘order’ => ‘ASC’, ‘post_status’ => ‘any’, ‘post_parent’ => null, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => ‘logo’ ) ) )); while ( $args->have_posts() ) : $args->the_post(); ?> An issue … Read more

Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy

I have registered a custom post type “Animals” and also two custom taxonomies (“Vertebrate” and “Type”) assigned to it, which have their own specific terms, for “Vertebrate” it will be “Mammals” and “Reptiles”, and for “Type” it will be “water type” and “ground type”. By using page.php I would like to display a list of … Read more

Remove “Comment” column in all post-types

I just want to remove Comment’s column in all post-types and in a single function My current function , Have to do each post-type like this : function remove_post_columns($columns) { unset($columns[‘comments’]); return $columns; } add_filter(‘manage_edit-post_columns’,’remove_post_columns’,10,1); function remove_page_columns($columns) { unset($columns[‘comments’]); return $columns; } add_filter(‘manage_edit-page_columns’,’remove_page_columns’,10,1); Possible to do in a single function and for future post-types ? … Read more