WordPress.org

Make WordPress Core

Ticket #41564: 41564.diff

File 41564.diff, 594 bytes (added by jmichaelward, 2 years ago)
  • src/wp-includes/template.php

     
    114114        if ( count( $post_types ) == 1 ) {
    115115                $post_type = reset( $post_types );
    116116                $templates[] = "archive-{$post_type}.php";
     117
     118                // Prepend the hyphenated post type name as a higher priority template.
     119                if ( strpos( $post_type, '_' ) ) {
     120                        array_unshift( $templates, 'archive-' . str_replace( '_', '-', $post_type ) . '.php' );
     121                }
    117122        }
    118123        $templates[] = 'archive.php';
    119124