Skip to content

Commit

Permalink
Post Types: Move back-compat registration later to avoid Gutenberg fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
iandunn committed Jul 26, 2023
1 parent c73d2cf commit 09f1e33
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ class WordCamp_Post_Types_Plugin_Back_Compat {
protected $template = '';

function __construct() {
// This must run before `WordCamp_Post_Types_Plugin::init()` so that `wcpt_back_compat_init` is registered
// before it's needed. This can't run before `init` because `gutenberg_get_theme_preview_path()` calls
// `wp_get_current_user()`, which isn't registered earlier.
add_action( 'init', array( $this, 'init' ), 5 );
}

/**
* Substitute the old shortcodes on older sites.
*/
public function init() {
// Array of themes that should work with this class.
$compat_themes = array(
'wordcamp-base',
Expand Down

0 comments on commit 09f1e33

Please sign in to comment.