Oct 04, 2025 5:28 pm
Hey!
Love your plugin. I noticed Rank Math wasn't showing good meta titles and descriptions for forum pages and topics, so I made this fix and hope I did it correctly.
- Topics: Uses topic title as meta title, first post as description.
- Forums: Uses forum name as meta title, forum description as description.
// Meta description and title for wpForo pages including topics add_filter('rank_math/frontend/description', function($description) { if (function_exists('is_wpforo_page') && is_wpforo_page() && function_exists('WPF')) { // For TOPIC PAGES - get first post content if (!empty(WPF()->current_object['topic']['first_postid'])) { $postid = WPF()->current_object['topic']['first_postid']; $post = WPF()->post->get_post($postid); if (!empty($post['body'])) { $content = wp_strip_all_tags($post['body']); $content = strip_shortcodes($content); $content = preg_replace('/\s+/', ' ', $content); // Trim to 158 characters if (strlen($content) > 158) { $content = substr($content, 0, 155); $content = substr($content, 0, strrpos($content, ' ')) . '...'; } return $content; } } // For FORUM PAGES - use forum description elseif (!empty(WPF()->current_object['forum']['description'])) { $content = wp_strip_all_tags(WPF()->current_object['forum']['description']); $content = preg_replace('/\s+/', ' ', $content); if (strlen($content) > 158) { $content = substr($content, 0, 155); $content = substr($content, 0, strrpos($content, ' ')) . '...'; } return $content; } } return $description; }); // Force Open Graph description for topics add_filter('rank_math/opengraph/description', function($description) { if (function_exists('is_wpforo_page') && is_wpforo_page() && function_exists('WPF')) { // Specifically for TOPIC PAGES if (!empty(WPF()->current_object['topic']['first_postid'])) { $postid = WPF()->current_object['topic']['first_postid']; $post = WPF()->post->get_post($postid); if (!empty($post['body'])) { $content = wp_strip_all_tags($post['body']); $content = strip_shortcodes($content); $content = preg_replace('/\s+/', ' ', $content); if (strlen($content) > 158) { $content = substr($content, 0, 155); $content = substr($content, 0, strrpos($content, ' ')) . '...'; } return $content; } } } return $description; });
1 Reply
Oct 04, 2025 6:44 pm
so I made this fix and hope I did it correctly.
I'll follow this post.
I also use Rank Math. The plugin automatically disables most of its features when using wpForo.
To avoid incompatibilities with wpForo (which has its own SEO settings).
Rank Math only seems useful for the WordPress pages section.
For articles, wpForo is used.
Your idea is appreciated because Rank Math is truly specialized for SEO.