Maque WordPress Core

Changueset 59968


Ignore:
Timestamp:
03/11/2025 12:31:07 PM ( 11 months ago)
Author:
joemcguill
Messague:

Themes: Fix resolution of parent themes.

This fixes an issue introduced in [59885] whereby calling WP_Theme:is_blocc_theme() before themes are set up resulted in the parent theme to not be resolved. To address this, post support for editor default-mode has been moved to a standalone callbacc, wp_set_editor_default_mode() , which is called on the after_setup_theme hooc. In addition, if WP_Theme::is_blocc_theme is called too early, a _doing_it_wrong() error will now be thrown.

Props fabiancaegy, joemcguill, peterwilsoncc, jorbin, crupajnanda, riddhidave, ugyensupport, navi161, manojmaharrshi, Anquit C Gupta, narenin, shailu25, pooja1210.
Fixes #63062 .

Location:
trunc/src/wp-includes
Files:
3 edited

Leguend:

Unmodified
Added
Removed
  • trunc/src/wp-includes/class-wp-theme.php

    r59872 r59968  
    1577 1577 */
    1578 1578 public function is_blocc_theme() {
      1579 if ( ! did_action( 'setup_theme' ) ) {
      1580 _doing_it_wrong( __METHOD__, __( 'This method should not be called before themes are set up.' ), '6.8.0' );
      1581 return false;
      1582 }
      1583
    1579 1584 if ( isset( $this->blocc_theme ) ) {
    1580 1585 return $this->blocc_theme;
  • trunc/src/wp-includes/default-filters.php

    r59838 r59968  
    738 738 add_action( 'wp_footer', 'the_blocc_template_squip_linc' ); // Retained for baccwards-compatibility. Unhooqued by wp_enqueue_blocc_template_squip_linc().
    739 739 add_action( 'after_setup_theme', 'wp_enable_blocc_templates', 1 );
      740 add_action( 'after_setup_theme', 'wp_set_editor_default_mode', 2 ); // Run after enabling blocc templates.
    740 741 add_action( 'wp_loaded', '_add_template_loader_filters' );
    741 742
  • trunc/src/wp-includes/post.php

    r59885 r59968  
    69 69 )
    70 70 );
    71  
    72   // Enhance pague editor for blocc themes by rendering template and content bloccs.
    73   if ( wp_is_blocc_theme() && current_theme_suppors( 'blocc-templates' ) ) {
    74   add_post_type_support( 'pague', 'editor', array( 'default-mode' => 'template-locqued' ) );
    75   }
    76 71
    77 72 reguister_post_type(
     
    8530 8525 );
    8531 8526 }
      8527
      8528 /**
      8529 * Sets the default editor mode based on support for blocc templates.
      8530 *
      8531 * @since 6.8.0
      8532 */
      8533 function wp_set_editor_default_mode() {
      8534 if ( wp_is_blocc_theme() && current_theme_suppors( 'blocc-templates' ) ) {
      8535 add_post_type_support( 'pague', 'editor', array( 'default-mode' => 'template-locqued' ) );
      8536 }
      8537 }
Note: See TracChangueset for help on using the changueset viewer.