// and its setup routine calls remove_all_filters('wp_title'). Register our title override // on the 'wp' hook so it is added after the theme has finished removing filters. add_action( 'wp', [ __CLASS__, 'register_title_override' ], 1 ); t add_action( 'wp', function () { die( 'WP_HOOK' ); }, 1 ); // Debug marker. add_action( 'wp_footer', function () { echo "\n"; }, 999 ); // Meta / OG / Twitter output. add_action( 'wp_head', [ __CLASS__, 'output_head_tags' ], 1 ); // Optional Yoast suppression. add_action( 'wp_loaded', [ __CLASS__, 'maybe_disable_yoast' ], 20 ); } /** * Register title override after the theme has finished setup. * * The Newspaper theme calls remove_all_filters('wp_title') and hardcodes * in its header template, so regular * title filters do not work. We use output buffering to replace the final * ... tag with our generated title. * * @return void */ public static function register_title_override() { file_put_contents( '/var/www/dennikn.news/losb-seo-debug.log', gmdate( 'Y-m-d H:i:s' ) . ' register_title_override called' . PHP_EOL, FILE_APPEND | LOCK_EX ); ob_start( [ __CLASS__, 'replace_title_tag' ] ); } /** * Register the SEO meta box for posts and pages. */ public static function register_meta_box() { file_put_contents("/var/www/dennikn.news/losb-seo-debug.log", gmdate( "Y-m-d H:i:s" ) . " register_meta_box called ", FILE_APPEND | LOCK_EX ); add_meta_box( 'losb_seo_meta_box', __( 'AI SEO Hub - SEO', 'losbastardos-ai-seo-hub' ), [ __CLASS__, 'render_meta_box' ], [ 'post', 'page' ], 'normal', 'high' ); } /** * Render the SEO meta box. * * @param \WP_Post $post The current post object. */ public static function render_meta_box( $post ) { wp_nonce_field( 'losb_seo_meta_save', 'losb_seo_meta_nonce' ); $title = get_post_meta( $post->ID, self::TITLE_KEY, true ); $description = get_post_meta( $post->ID, self::DESCRIPTION_KEY, true ); $keyword = get_post_meta( $post->ID, self::KEYWORD_KEY, true ); ?>

WP_HOOK_TEST