$args = [
....
"rewrite" => [ "slug" => "resources/%resource_type%", "with_front" => false ],
....
];
register_post_type( "latest_resource", $args );
Then, I use a filter to replace the string %resource_type% with the custom taxonomy term:
function resources_change_permalinks( $post_link, $post ){
if ( is_object( $post ) && $post->post_type == 'latest_resource' ){
$terms = wp_get_object_terms( $post->ID, 'resource_type' );
if( $terms ){
return str_replace( '%resource_type%' , $terms[0]->slug , $post_link );
}
}
return $post_link;
}
add_filter( 'post_type_link', 'resources_change_permalinks', 1, 2 );
Works great. And in the Yoast Sitemap under latest_resource-sitemap.xml all of the permalinks appear exactly how I want them. Everything looks wonderful…
EXCEPT the very first entry in the latest_resource-sitemap.xml sitemap is:
https://www.myURL.com/resources/%resource_type%/
I am unsure how to troubleshoot. Is there a way I can filter the sitemap to ensure this string is not included? Should I be rewriting the permalink structure another way?
Any insight or advice is greatly appreciated. Thanks!
]]>My problem: My event links come out as “https://website.com/all-events/?event=2499
” for all of the events I created. What I tried: Settings > Permalinks > “Post name” > save again… and flushed the cached. Same result.
Question: Could you please tell me how to fix this?
About my setup: I’m trying out the free version of EventPrime. I’m using Elementor Pro and their (barebones) Hello theme.
Thanks in advance
Michelle
I’d like my blog links to be domain/blog/postname. But when I set the permalinks to this custom structure, the brand links become domain/blog/brand/brandname.
Is it possible to remove the “blog” from just the brand links?
Thanks,
Debbie
domain.com/YYYY-MM-DD/post-name/
. Is this format bad for SEO? I have read many articles about SEO that say having the year in the URL can negatively impact rankings. Users may think the post is old and outdated, leading to a higher bounce rate.
However, my question is: how do search engines view this? Do search engines themselves rank these pages lower because of the date in the URL?
]]>I am reference to this support topic: https://www.ads-software.com/support/topic/product-category-base-same-as-custom-base/
As @saraeee “said it’s not possible to have same base URL for category and product links”, like this.
Main shop page:
mysite.com/shoppage
Category page:
mysite.com/shoppage/mycategory
Product page
mysite.com/shoppage/mycategory/myproduct
So this kind of permalink-structure above is completely impossible to achieve? Also with the plugin: https://woocommerce.com/products/custom-permalinks-for-woocommerce/ ?
Hope for replies and suggestions.
Best regards,
Alex
Permalinks keep breaking. My homepage becomes a 404 until I re-save Permalinks, then after a while they break again.
I see others have had this issue. (FYI, Yoast SEO is not active on this site — which I see was an issue for some.)
Does anyone have a remedy for this? We discovered this issue yesterday, at which point I updated Polylang to the latest, 3.6.4, and re-saved Permalinks. Fixed.
And yet, after several hours Permalinks break again!
Advice appreciated,
Mark
]]>I think the problem is a plugin but I’m not sure which one. Anyone having similar issues recently? I think it may be plugin issue. I’m not very technical but I have tried to follow all the suggestions for solving Permalinks issues and nothing seems to work… Thanks in advance for any suggestions.
]]>