Support » Plugin: CPT-onomies: Using Custom Post Types as Taxonomies » [Plugin: CPT-onomies: Using Custom Post Types as Taxonomies] Custom post types WPML translated posts

  • Hi Rachel,

    First of all, thanks again for the plug-in.

    I’ve run into an issue with CPT-onomies and WPML and this is what I posted in WPML’s support forum:

    I’ve got a custom post type (‘directors’) and my client accidentally created all the translated content as duplicates. The problem is, even if I disable the duplication, ie. set the post to “Translate independently”, the translated post still 301-redirects to the original post.

    My permalink structure for the custom posts is the post title. Now if I manually change the translation’s slug to something else, the redirection stops. But as you can see, I’m trying to list directors here and it’s important that name of the director is in the URL. So basically (I actually have the languages reversed but since you don’t understand Finnish it’s easier to describe it like this):

    At the moment the latter gets redirected to the former no matter what settings I change. I cannot understand where this behavior comes from and why.

    Note that if the Director post are translated without first setting them as duplicates, everything works as expected. But like I mentioned, my client already did it the wrong way.

    The culprit seems to be the combination of WPML and CPT-onomies. Furthermore this issue is occurring now randomly, and on occasion even deleting and re-creating both the original and the translated post does not mend the issue (this was my initial workaround).

    I believe this issue has something to do with canonical redirection. If I comment out line 375 in sitepress.class.php (WPML file), that is

    function icl_redirect_canonical_wrapper(){
    global $_icl_server_request_uri, $wp_query;
    $requested_url = ( !empty($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
    $requested_url .= $_SERVER['HTTP_HOST'];
    $requested_url .= $_icl_server_request_uri;
    //redirect_canonical($requested_url); I COMMENT THIS OUT

    the redirection stops. But then I get a 404 for the translated post.

    Once again, this is only happening when the slugs of the custom post type posts in different languages are identical. If I change either slug, everything works as expected.

    Thank you for any help you can offer.

  • The topic ‘[Plugin: CPT-onomies: Using Custom Post Types as Taxonomies] Custom post types WPML translated posts’ is closed to new replies.