I want to display my custom post type arranged by taxonomy

That’s because you’re echoing the Parent term name outside of the loop. $custom_terms = get_terms(‘material_category’); foreach($custom_terms as $custom_term) { $args = array(‘post_type’ => ‘materials’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘material_category’, ‘field’ => ‘slug’, ‘terms’ => array(‘general-english’) ), ), ); $loop = new WP_Query($args); if ($loop->have_posts()) { while ($loop->have_posts()) : $loop->the_post(); echo ‘<h2>’ . $custom_term->name … Read more

How to display user-defined / custom post in wordpress?

Try below code index.php <?php $args = array( ‘post’ => ‘people’, ‘post_status’ => ‘publish’ ) query_posts( $args ); ?> <?php if ( have_posts() ) : ?> <!– the loop –> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( ‘content-templates/content’, ‘people’ ); ?> <?php endwhile; ?> <?php else : ?> <?php get_template_part( ‘content-templates/content’, ‘none’ … Read more

How to disable Publish button on Edit post if post title exists

You can achieve this by adding post.php to your conditional check before enqueuing your script. NOTE: This might effectively disable the ability to update posts. add_action(‘admin_footer’, function() { global $pagenow; if ( !$pagenow || !in_array($pagenow, array( ‘post-new.php’, ‘post.php’ )) ) return; // only enqueue when writing/editing posts ?> <script> jQuery(document).ready(function($){ $(document).on(“change”, “#titlediv #title”, function(e){ var … Read more

Automatically convert standard posts with custom fields to custom post types

The question: what is the easiest way to convert standard posts with custom fields into a new custom post type There’s no “easy” way. Consider that all posts have custom fields (some are hidden, and WordPress will add them). So you would need to convert post types based on the presence / value of specific … Read more