Skip to main content
7 votes
Accepted

Where does Yoast SEO plugin sets the site/page title?

There's a wpseo_title filter you can hook into. Example: add_filter('wpseo_title', 'add_to_page_titles'); function add_to_page_titles($title) { $title .= $addToTitle; return $title; }
WebElaine's user avatar
  • 9,664
7 votes

Yoast SEO breadcrumbs: how to create a filter that uses the url slug for breadcrumb titles

Yoast does have a filter for you to use. See here: https://gist.github.com/jmcclellan/b2d97ffee0e924e28fa1 I used this to add "parent" pages to custom post types. We wanted to use pages as our ...
RedForest's user avatar
6 votes

How to rewrite title- and meta-description templates for page templates in Yoast Plugin

You may consider the use of both filter wpseo_metadesc (for meta description) and wpseo_title (for title). The idea is to change the values of title and/or description depending if you meet some ...
Temani Afif's user avatar
5 votes
Accepted

Query Post Based of Yoast Primary Category Class

Yoast SEO stores the primary term ID as the post meta field _yoast_wpseo_primary_{taxonomy}. Knowing this you can use a meta query to get all posts with primary category ID X: $query = new WP_Query([ ...
TheDeadMedic's user avatar
  • 36.6k
4 votes

make the url unlimited

You might think it's 39 characters long, but it's actually 332 characters long. This is the real URL you're trying to use: https://sitename.com/%D8%A8%D8%B1%D9%85%D8%AC%D8%A9-%D8%AA%D8%B5%D9%85%D9%...
Tom J Nowell's user avatar
  • 60.6k
4 votes

Exclude custom post_type in sitemap generation?

If you are using functions.php script to register custom post type, you should declare false to 'has_archive' => true,. function custom_post_type() { $labels = array( ... ); $args = array( ...
iMarkDesigns's user avatar
4 votes

How to override the title tag for woocommerce endpoints?

If you added custom WC endpoints on init, you can use something like this instead to check for endpoints (adjust accordingly if you're using Yoast): function add_custom_endpoints_to_title( $...
rosie's user avatar
  • 41
4 votes

Custom Yoast Breadcrumbs URL

That's an unusual setup - Yoast usually recognizes the right permalinks. You may want to consider changing the way you set up your custom post type, so that it has the desired names and URLs to begin ...
WebElaine's user avatar
  • 9,664
4 votes

wp_get_canonical_url showing first url of the post for custom page

This is because wp_get_canonical_url can only be used on posts, and cannot be used for tags authors archives etc. Returns the canonical URL for a post. https://developer.wordpress.org/reference/...
Tom J Nowell's user avatar
  • 60.6k
3 votes
Accepted

Every new post/draft has a custom field variable "yst_is_cornerstone" showing

Yes, this is a new Yoast SEO feature. It's a checkbox, so as long a you don't select it in the SEO-metabox, the value will be zero/empty. I presume it's overwritten every time the post is saved, hence ...
cjbj's user avatar
  • 15k
3 votes

Set Custom Post feature image as og:image

you can make your own plugin, or just use it in your functions.php add_action('wp_head', 'dgsoft_fb'); function dgsoft_fb(){ if( is_single() ) { echo '<meta property="og:image" content=...
vencedor's user avatar
  • 131
3 votes
Accepted

Can I change the contents of a description meta tag generated by Yoast?

Take a look at WordPress SEO API Docs it appears you can modify the meta description tag will somthing like: add_filter('wpseo_metadesc', function($description){ if ($wtv_language == 'wtv') { ...
David Sword's user avatar
  • 3,357
3 votes

How can I change the <head> tag contents of individual Wordpress posts?

I would read this article, its from Yoast. I don't think you are understanding what the focus keyword feature does. This article talks about that as well as how adding the keyword meta tag is a ...
RiddleMeThis's user avatar
  • 3,787
3 votes
Accepted

Wrong Canonical url link

You need to reset your indexables. There are a couple of ways to do this - you can use a WP-CLI command (wp yoast index), or you can use the Yoast Test Helper plugin. If you install the Yoast Test ...
WebElaine's user avatar
  • 9,664
3 votes
Accepted

Can't print Yoast meta description into page template (syntax error, unexpected '.')

There is indeed an unwanted ; (semicolon) in your function (try to look at line 99 in the twentytwentyone-child/functions.php file) which likely is the cause to the syntax error. So just remove that ; ...
Sally CJ's user avatar
  • 39.9k
2 votes

Edit title-tag in wp_head with yoast seo

I don't think adding <span itemprop> to the <title> is a good idea... If you can not use any existing tags like <h1> for that, you may consider adding meta tag: <meta itemprop="...
Worduoso's user avatar
  • 271
2 votes

remove rel=next on home page but not others

Here is the answer: function bg_disable_front_page_wpseo_next_rel_link( $link ) { if ( is_front_page() ) { return false; } return $link; } add_filter( 'wpseo_next_rel_link', '...
NiteRaven's user avatar
2 votes

Yoast SEO Calling content filters 2 additional times

The core of your problem is that the_content is a filter not an action, and it is supposed to return values, not echo them. As for the "called number of times" part of the question, yes any hook can ...
Mark Kaplun's user avatar
  • 23.7k
2 votes

Exclude custom post_type in sitemap generation?

If you need a filter solution: add_filter( 'wpseo_sitemap_exclude_post_type', 'your_prefix_exclude_cpt_from_sitemap', 10, 2 ); function your_prefix_exclude_cpt_from_sitemap( $value, $post_type ) { ...
Brandon's user avatar
  • 21
2 votes

Exclude custom post_type in sitemap generation?

This question has been asked a long time ago, but the answer is kind of simple: Go to SEO --> Search Appearance. Select tab Contenttypes. Scroll down, here you can display or hide custom post types ...
H. Rensenbrink's user avatar
2 votes

Where does Yoast SEO plugin sets the site/page title?

Where does Yoast SEO plugin sets the site/page title? Yoast SEO plugin adds two hooks that filter the title. add_filter( 'pre_get_document_title', array( $this, 'title' ), 15 ); add_filter( '...
Nathan Johnson's user avatar
2 votes

Display Yoast WordPress SEO title in archive template

Getting the focus keyword for categories and tags To get the focus keyword of a Category or Tag programmatically, you can use either of these two methods: /** Method 1. Tap into the ...
Fabien Snauwaert's user avatar
2 votes

How to Modify Breadcrumb Page Names for Specific Pages?

We generally don't answer plugin-specific questions here so you may find more help in a Yoast-specific forum. To point you toward the right direction, though, there is a filter called ...
WebElaine's user avatar
  • 9,664
2 votes

Post content blank after disabling Yoast SEO

Turns out the single-post.php template was missing a call to the_post(). Since that function initializes all the postdata used by functions like the_content(), WordPress had nothing to display. As ...
joemaller's user avatar
  • 208
2 votes
Accepted

Filter yoast canonical add_action priority

You would need to look in the Yoast plugin to find what the global class is that is referred to as $this, so that you can access it outside the class context. If it was for example, $wpseo, in your ...
majick's user avatar
  • 5,131
2 votes
Accepted

Facebook og:image issues after https change

The https change was not the cause. Actually - coincidentally - the W3 Total Cache was updated on the same day, and the Minify setting was breaking lines between meta and property words on the HTML, ...
Adriano Castro's user avatar
2 votes

htaccess: Remove trailing slash from URL ending with .xml/ only

If you're outputting a sitemap, there's no reason to wait for the query for your page- which is what is producing the redirect. Hook an earlier action and you won't need anything to counter the ...
Milo's user avatar
  • 78.8k
2 votes

How to parse Yoast SEO Snippet Variables

Ok here is how I parsed the snippets in case anyone else needs to know $id = get_the_ID(); $post = get_post( $id, ARRAY_A ); $yoast_title = get_post_meta( $id, '_yoast_wpseo_title', true ); $...
baskin's user avatar
  • 31
2 votes
Accepted

When does the Yoast SEO filter hook wpseo_sitemap_urlimages fire?

What I wanted to say in my previous comment: This hook is only fired when the sitemap is being built. After that, it's cached and always served from cache. That means you'll never see any change on ...
swissspidy's user avatar
  • 3,914
2 votes
Accepted

Yoast SEO settings unavailable in an archive page from wordpress plugin

Yoast SEO can have limitations for archive pages. Try a different SEO plugin such as Rank Math perhaps. Your other option would be to open the archive.php file of your theme and add your custom code ...
MistaPrime's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible