Sent due to lack of responses.
I'm having trouble setting up a custom canonical name using the Wordpress SEO API: http://yoast.com/wordpress-seo-api-docs/
I have a custom post type called a design that uses custom URL rewriting. He takes the base page / design / and adds the name of the design to it, for example / design / a -design /. Canonical in Wordpress SEO is / design / page by default.
I want to write a function that determines if it is a design page and returns another canonical one. I can check if it was a design page by doing if ($design == ""){ and I tried to use a custom link URL, but the function just completely removes the canonical version.
Here is my main function:
function design_canonical(){ if ($design == "") { // Leave blank and Yoast SEO will use default canonical for posts/pages } else { return $design['detailslink']; } } add_filter( 'wpseo_canonical', 'design_canonical' )
It is obvious that something is wrong, but I'm not quite sure what.
Thoughts?
source share