-
I have found this link: https://support.rankmath.com/ticket/code-to-use-meta-title-in-php-markup/ to fetch the post / page / product. It looks very helpful (in fact much better than Yoast), however, it returns an empty long text string: ” ”
// $product = object(WP_Post)#14336 (24) [....] $title = RankMath\Helper::get_settings( "titles.pt_{$product->post_type}_title" ); // "%buy% %customterm(pa_designer)% %title% %page% %sep% %singular_category_name% %materials%" dd(RankMath\Helper::replace_vars( $title, $product )); // returns: string(6) " "
What am I doing wrong? And how come it doesn’t work?
I am developing a custom api restpoint where the title has to be returned, so this call is being accessed through wp-json (the rest api of wordpress)
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The ticket ‘How to get title for a page/post/product?’ is closed to new replies.