How to start a new post with custom Taxonomies already set?

You can use the transition_post_status action for that. New posts transition from new to auto-draft, so we check for that condition to only add terms on that initial auto-save. function wpd_add_post_terms( $new_status, $old_status, $post ) { if( ‘new’ == $old_status && ‘auto-draft’ == $new_status ){ wp_set_post_terms( $post->ID, array( 42, 23 ), ‘category’ ); } } … Read more

WP Meta query for a custom post type based on two values

OK, so that’s a little example of what I call “wishful coding” 😉 get_terms(array( ‘taxonomy’ => ‘property-status’, ‘value’ => array(‘For Rent’, ‘Arrendamento’), ‘compare’ => ‘IN’, ) ) You use get_terms function here, which will Retrieve the terms in a given taxonomy or list of taxonomies. And you use this inside of meta_query part of a … Read more

Allow Editor to view/modify a custom post type

I suspect the problem is not when you register the post type but when you create the menu pages. When you call add_submenu_page() make sure that the $capability argument is correct. In your case you want ‘edit_posts’: $capability = ‘edit_posts’; add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug );

Side effects of Script and Iframe in post

The recommended method for embedding iframes is using the <iframe> tag. It makes for better syntax and also allows you to control the iframe much better. For example, you are able to remove an iframe’s border, control scrolling options, etc. <iframe src=”https://jsfiddle.net/o7usdL0a/embed/result/” style=”width: 100%; height: 300px” scrolling=”no” marginwidth=”0″ marginheight=”0″ frameborder=”0″> </iframe> The <script async> and … Read more

WordPress loop: Show only a Custom Post Type Taxononmy TERM

I found the solution by myself, I leave it here in case someone is interested: <?php $args = array( ‘post_type’ => ‘agrupados’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘pedidos’, ‘field’ => ‘slug’, ‘terms’ => ‘ferrol’, ), ),); $the_query_slide = new WP_Query( $args ); if ( $the_query_slide->have_posts() ) {while ( $the_query_slide->have_posts() ) {$the_query_slide->the_post();?> <?php /* variables … Read more