Created
April 25, 2023 07:37
-
-
Save maheshwaghmare/0ae7ca3f57dd9a33f790772d009f94c1 to your computer and use it in GitHub Desktop.
Exclude post type from rank math analytics. Here we excluded the `plgnoptmzr_work` post type from the Rank Math analytics screens. Note: After adding the code just update any single excluded post type once so the Rank Math re-analyze and exclude the post type from the database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists( 'prefix_rank_math_excluded_post_types' ) ) : | |
function prefix_rank_math_excluded_post_types( $post_types = [] ) { | |
// Add the post types which you want to exclude. | |
$excludes = [ | |
'plgnoptmzr_work', | |
]; | |
return array_diff_key( $post_types, array_flip( $excludes ) ); | |
} | |
add_filter( 'rank_math/excluded_post_types', 'prefix_rank_math_excluded_post_types' ); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment