Rank Math Support
Forum Replies Created
-
Hello @yi100,
Here is a filter to create a variable to output the title of the three latest posts of a category:add_action('rank_math/vars/register_extra_replacements', function () {
rank_math_register_var_replacement(
'post_titles',
[
'name' => esc_html__('Post Titles', 'rank-math'),
'description' => esc_html__('Title of posts', 'rank-math'),
'variable' => 'post_titles',
'example' => post_titles_callback(),
],
'post_titles_callback'
);
});
function post_titles_callback() {
if (is_category()) {
$cat = get_queried_object_id();
$myposts = get_posts(array('numberposts' => 3, 'offset' => 0, 'category__in' => array($cat), 'post_status'=>'publish', 'order'=>'DESC' ));
$titles = [];
foreach ($myposts as $post) {
$titles[] = get_the_title($post->ID);
}
return implode(', ', $titles);
}
}You can use the %post_titles% variable after adding the filter.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @braino,
Thank you for contacting Rank Math support.
We are aware of the issue and working on a solution. Please disable the notice by setting the WP_DEBUG_DISPLAY and WP_DEBUG_LOG constants to false in the wp-config.php file. If you don’t want to do that, please add the following filter to rank-math.php file.
add_filter( 'doing_it_wrong_trigger_error', '__return_false' );
Here is how to create the rank-math.php file: https://rankmath.com/kb/wordpress-hooks-actions-filters/#rank-math-php-file
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello,
We are really sorry about this. We have identified the issue and plan on fixing it with the next update.
We would really appreciate your patience in the meantime.
Hello @paxmont,
Thank you for contacting Rank Math support.
We are aware of the issue and working on a solution. Please disable the notice by setting the WP_DEBUG_DISPLAY and WP_DEBUG_LOG constants to false in the wp-config.php file. If you don’t want to do that, please add the following filter to rank-math.php file.
add_filter( 'doing_it_wrong_trigger_error', '__return_false' );
Here is how to create the rank-math.php file: https://rankmath.com/kb/wordpress-hooks-actions-filters/#rank-math-php-file
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @scooterlord,
Thank you for contacting Rank Math support.
Please share a screenshot of the Redirections section ( WP Dashboard > Rank Math SEO > Redirections ) using a tool like https://imgur.com/. Also, navigate to WP Dashboard > Rank Math SEO > Status & Tools > System Status > Copy System Info to Clipboard and share it with us so we can check and assist you further.
Looking forward to helping you.
Hello @albarosa,
Thank you for contacting Rank Math support.
Our plugin can’t control why the post URLs are not working when visiting them using Facebook posts. Our plugin’s meta tags are only used to generate the link preview. The fb:app_id tag also doesn’t have anything to do with the issue. You can share an affected URL so we can check if we can provide you further insights that might help you fix the issue.
Looking forward to helping you.
Hello @yi100,
Thank you for contacting Rank Math support.
You can use the following filter to use the latest post titles as the category description:
add_filter('rank_math/frontend/description', function ($description) {
if (is_category()) {
$cat = get_queried_object_id();
$myposts = get_posts(array('numberposts' => 3, 'offset' => 0, 'category__in' => array($cat), 'post_status'=>'publish', 'order'=>'DESC' ));
$titles = [];
foreach ($myposts as $post) {
$titles[] = get_the_title($post->ID);
}
return $titles[0]. ', ' .$titles[1]. ', '.$titles[2];
}
return $description;
});Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @bibberle,
The queries are correct. Please note that the first query will also remove the primary category you have set for the posts(if you’re using the Primary Taxonomy feature of our plugin). You must add them again after running the query. Also, make sure to take a complete database backup before running the queries to be safe in case something goes wrong.
Please do not hesitate to let us know if you need our assistance with anything else.
Forum: Plugins
In reply to: [Rank Math SEO – AI SEO Tools to Dominate SEO Rankings] IndexNow not workHello @masouddarvishi1992,
It is already mentioned in the description of the Instant Indexing module that it is used to submit the URLs to Bing & Yandex. Here is a screenshot for your reference: https://i.rankmath.com/i/6hmPl3
Please do not hesitate to let us know if you need our assistance with anything else.
Hello @rstrah,
Please confirm if you want to exclude the URLs from the page sitemap. If so, the filter should work fine. Please make sure to clear sitemap cache. If you want to remove the URLs from their specific post type sitemaps, you should use the following filter:
add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
return '';
}, 10, 2 );Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @omahoung,
Thank you for contacting Rank Math support.
We are aware of the issue and working on a solution. Please disable the notice by setting the WP_DEBUG_DISPLAY and WP_DEBUG_LOG constants to false in the wp-config.php file. If you don’t want to do that, please add the following filter to rank-math.php file.
add_filter( 'doing_it_wrong_trigger_error', '__return_false' );
Here is how to create the rank-math.php file: https://rankmath.com/kb/wordpress-hooks-actions-filters/#rank-math-php-file
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @ywtywt,
Thank you for contacting Rank Math support.
We are aware of the issue and working on a solution. Please disable the notice by setting the WP_DEBUG_DISPLAY and WP_DEBUG_LOG constants to false in the wp-config.php file. If you don’t want to do that, please add the following filter to rank-math.php file.
add_filter( 'doing_it_wrong_trigger_error', '__return_false' );
Here is how to create the rank-math.php file: https://rankmath.com/kb/wordpress-hooks-actions-filters/#rank-math-php-file
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @mcdeth,
You can use the following filter to set the hidden products as follow:
add_filter( 'rank_math/frontend/robots', function( $robots ) {
if ( ! is_product() ) {
return $robots;
}
$product = \wc_get_product();
$is_hidden = $product && $product->get_catalog_visibility() === 'hidden';
if ( $is_hidden ) {
$robots['nofollow'] = 'follow';
}
return $robots;
}, 11 );Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @rstrah,
Thank you for contacting Rank Math support.
Please use the following filter to exclude the URLs from the sitemap:
add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ){
$excluded_urls = [
'https://site.com/blog/',
'https://site.com/case_studies/',
'https://site.com/services/',
'https://site.com/solutions/'
];
$post_url = get_permalink($object->ID);
if ($type === 'post') {
if (in_array($post_url, $excluded_urls)) {
return '';
}
}
return $url;
}, 10, 3 );Please make sure to flush the Sitemap cache by following this video screencast after adding the filter: https://i.rankmath.com/pipRDp
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hello @mcdeth,
Thank you for contacting Rank Math support.
If you don’t want the hidden products to be set to noindex, navigate to WP Dashboard > Rank Math SEO > General Settings > WooCommerce and disable the Noindex Hidden Products option.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.