admin管理员组文章数量:1122833
So I wanted to create custom permalinks for my pages for an SEO project I’m working on.
I can customise the permalink fine as I have downloaded a custom permalink plugin, but the YOAST plug-in I’m using has a different slug that it takes.
For example, I want to change an existing post from:
/sports-therapy-services/
To
/services/sports-therapy/
So I can do this part fine. However, when I save changes, the slug that shows on YOAST is:
sports-therapy-services
It is replacing the slash with a dash.
Is there a way so I can put in slashes into the YOAST slug? Or is there a way to make the YOAST slug match what I have put into the custom permalink?
So I wanted to create custom permalinks for my pages for an SEO project I’m working on.
I can customise the permalink fine as I have downloaded a custom permalink plugin, but the YOAST plug-in I’m using has a different slug that it takes.
For example, I want to change an existing post from:
/sports-therapy-services/
To
/services/sports-therapy/
So I can do this part fine. However, when I save changes, the slug that shows on YOAST is:
sports-therapy-services
It is replacing the slash with a dash.
Is there a way so I can put in slashes into the YOAST slug? Or is there a way to make the YOAST slug match what I have put into the custom permalink?
Share Improve this question asked Feb 3, 2023 at 17:36 Frankie LevinFrankie Levin 11 bronze badge1 Answer
Reset to default 0If the YOAST SEO plugin's slug is not taking the custom permalink that you have set, there are a few potential solutions:
Check the settings: Go to the YOAST SEO settings and make sure that the custom permalink setting is enabled.
Disable pretty permalinks: Try disabling the "pretty permalinks" setting in WordPress and see if the custom permalink is honored. If it is, you can re-enable pretty permalinks and try a different solution.
Use the wpseo_slug filter: You can use the wpseo_slug filter to set the custom permalink for YOAST SEO. Add the following code snippet to your WordPress theme's functions.php file:
add_filter( 'wpseo_slug', 'set_custom_permalink', 10, 1 ); function set_custom_permalink( $slug ) { // Check if we are on the post type that should use the custom permalink if ( get_post_type() === 'custom_post_type' ) { // Set the custom permalink $slug = 'custom-permalink'; } return $slug; }
In this example, the code uses the wpseo_slug filter to set the custom permalink for the custom post type with the name "custom_post_type". Make sure to replace "custom-permalink" with the actual custom permalink that you want to set.
Note: The wpseo_slug filter may not work in all cases, depending on your WordPress setup and other plugins that you have installed. If this solution doesn't work, you may need to try a different approach or reach out to the YOAST SEO support team for further assistance.
本文标签: pluginsYOAST slug does not take the custom permalink I have made
版权声明:本文标题:plugins - YOAST slug does not take the custom permalink I have made 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736284013a1927157.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论