Add author name to article schema if its missing

add_filter( ‘aioseo_schema_output’, ‘add_author_name_when_missing’ ); function add_author_name_when_missing( $schema ) { if ( is_single() && ‘post’ == get_post_type() ) { global $post; $author_id = $post->post_author; $author_name = get_the_author_meta( ‘display_name’, $author_id ); foreach ( $schema as &$schemaItem ) { if ( isset($schemaItem[‘@type’]) &&…Continue reading

Simple Table Of Contents

add_filter( ‘the_content’, function ( $content ) { // This snippet requires the DOMDocument class to be available. if ( ! class_exists( ‘DOMDocument’ ) ) { return $content; } if ( !is_single() || !in_the_loop() || !is_main_query() ) { return $content; }…Continue reading

Disable jQuery Migrate

add_action( ‘wp_default_scripts’, function ( $scripts ) { if ( ! is_admin() && isset( $scripts->registered[‘jquery’] ) ) { $script = $scripts->registered[‘jquery’]; if ( ! empty( $script->deps ) ) { $script->deps = array_diff( $script->deps, array( ‘jquery-migrate’ ) ); } } }, 150…Continue reading