Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/admin-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function maybe_modify_post_edit_columns() {
}
}
}
add_action( 'init', __NAMESPACE__ . '\maybe_modify_post_edit_columns' );
add_action( 'wp_loaded', __NAMESPACE__ . '\maybe_modify_post_edit_columns' );

/**
* Add a 'byline' column in the Posts list table, and rebrand the 'author' column.
Expand Down
2 changes: 1 addition & 1 deletion inc/class-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Utils {
*/
public static function get_supported_post_types(): array {
static $post_types;
if ( ! isset( $post_types ) ) {
if ( ! isset( $post_types ) || ! did_action( 'wp_loaded' ) ) {
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition ! did_action( 'wp_loaded' ) will cause the cache to be invalidated and regenerated on every call before wp_loaded fires, negating the purpose of the static cache during early execution. Consider using did_action( 'wp_loaded' ) && ! isset( $post_types ) instead, or only caching after wp_loaded has fired: if ( ! isset( $post_types ) || ( ! did_action( 'wp_loaded' ) && isset( $post_types ) ) ).

Suggested change
if ( ! isset( $post_types ) || ! did_action( 'wp_loaded' ) ) {
if ( did_action( 'wp_loaded' ) && ! isset( $post_types ) ) {

Copilot uses AI. Check for mistakes.
$post_types = get_post_types_by_support( 'author' );
}

Expand Down
Loading