• Resolved Digihood

    (@josif201)


    Hello there,

    Great plugin, I’ve been using it for a year now. But just today I’ve noticed a problem with the duplicating. When I duplicate a custom post-type and change the URL of the duplicate to something else. The original post-type is re-directed to the newly created one. And I can’t access the old one at all.

    Could you help please?

    Thank you!

    Tereza

    https://www.ads-software.com/plugins/post-duplicator/

Viewing 15 replies - 1 through 15 (of 32 total)
  • This is a pretty serious bug, steps to replicate for developer:

    post ID 1 /my-post/ 
    
    > duplicate creates new concept > 
    
    [concept] post ID 2 /my-post-2/
    
    > publish creates postmeta >
    
    _wp_old_slug ID 2 /my-post/

    This meta field causes the original url to redirect to the duplicated post. It is created on the publish action of the duplicated concept.

    Plugin Author metaphorcreations

    (@metaphorcreations)

    This plugin does not add any new metadata to your posts (it copies existing meta from the original to the new post), and doesn’t have any code at all that modifies the original post that is being duplicated. I’m guessing you have another plugin or something in your theme that is causing this conflict upon duplication.

    Please run through this article https://metaphorcreations.ticksy.com/article/1483/ to see if you can pinpoint where this issue is stemming from.

    Plugin Author metaphorcreations

    (@metaphorcreations)

    I did some more testing just to be sure. I printed out all custom post meta along with the post class object and do not see any type of meta called “_wp_old_slug” in the original or duplicated posts before or after changing the title and/or slug and publishing.

    Are you sure you guys are using my plugin and not some other post duplicating plugin?

    Thanks for your reply metaphorcreations. Some more information:

    – Plugin version: 2.12 | Metaphor Creations. No other active plugins.

    – I think that the original slug has to have been changed to trigger this behavior.

    – Occurs only after publishing the duplicated post, not on creation.

    Steps:

    1) Create post "test"
    
    2) Change post slug to "test-bla"
    
    3) select * from $wpdb->postmeta where meta_key = '_wp_old_slug'
    
    meta_id	post_id	meta_key	meta_value
    1	1	_wp_old_slug	test
    
    4) Duplicate post
    
    Concept automatic slug is: /test-bla-2/
    
    5) Publish clone
    
    6) select * from $wpdb->postmeta where meta_key = '_wp_old_slug'
    
    meta_id	post_id	meta_key	meta_value
    1	1	_wp_old_slug	test
    2	2	_wp_old_slug	test

    After some more testing it appears that i have one site where the slug of the original post has to have been changed (step 2 above) for this to occur, and another site where it is enough to just duplicate a post (as in comment 2 of this thread). I currently have no idea why this behavior differs between the sites, i cannot relate it to another plugin, specific post type or rewrite rules at this time.

    Plugin Author metaphorcreations

    (@metaphorcreations)

    Ok, I think I may have found a solution to this… I still never ran into the issue described above, but I now see the “_wp_old_slug” metadata that gets created. This does not get created by my plugin, but from the WP core when slugs are updated. I also tracked down this function https://codex.www.ads-software.com/Function_Reference/wp_old_slug_redirect that WordPress uses to try and redirect old slugs to their new/updated location. So, I can see where this would probably cause an issue.

    I just released an update that ensures this data does not get copied over to duplicated posts. When you get a chance, please update your plugin and let me know if the issue is resolved.

    Thanks!

    I just upgraded to version 2.13 but i’m afraid that the issue is still present (on at least one of my sites).

    What i notice is that when a post is duplicated, the title is updated to reflect that it’s a copy but the postname is not:

    ID post_title          post_name        post_type
    --------------------------------------------------
    1  Test                test             publish
    2  Test Copy           test             Draft

    When i change the postname of ID 2 to ‘test-copy’ before publishing the post, the _wp_old_slug entry is not created. Could this be a simple fix for the problem?

    Thread Starter Digihood

    (@josif201)

    Hi guys,

    thank you very much for your response!

    I always change the url as a first thing after duplicating the post (always before publishing), so I’m not sure, taht is the problem. And also, this happens only sometimes, not everytime I duplicate a post.

    I’m not a web developer, so I’m sorry if this is not relevant.

    Thanks!

    Thread Starter Digihood

    (@josif201)

    I’ve just updated the plugin and run some tests and it is definitely not working for me. I should say, that I delete the word “Copy” from the post title, so the titles of the duplicate and original posts are the same (but I do change the url).

    Plugin Author metaphorcreations

    (@metaphorcreations)

    @litemotiv, I see what you are saying with the post_name. This does happen if you duplicate to a Draft post, but as soon as you publish the post WordPress will automatically make it a unique slug (usually by adding “-2” to the slug) using the unique_slug function https://codex.www.ads-software.com/Function_Reference/wp_unique_post_slug

    I still can’t replicate the issue you guys are having, so I’m still a bit unclear as to what is actually happening on your sites. Would you be willing to provide me with temporary Dashboard and FTP access to check it out directly on your site?

    You can connect with me through the form at the bottom of this page: https://www.metaphorcreations.com/

    Also, have you tested while using a default WP theme and all other plugins disabled?

    Thread Starter Digihood

    (@josif201)

    I’ve just swiched off all other plugins and even tried twentyfifteen theme and it is still not working. I’m using WOrdpress 4.4 and I have a feeling that it was ok in all the previous version of Worpress.

    Plugin Author metaphorcreations

    (@metaphorcreations)

    Ok, thanks for letting me know. This is very strange. I wish I could replicate the issue.. I have not hear this from anyone but you 2 (so far), but it would be nice to figure out what is going on.

    @metaphorcreations: i understand what you’re saying about the unique_slug function, but like i said it seems to fix the problem if the duplicated postname is unique before publishing, instead of a copy of the original. So when i add this line:

    // post-duplicator/includes/ajax.php (line #27)
    $duplicate['post_name'] = $duplicate['post_name'].'-copy';

    the problem doesn’t seem to appear.

    Thread Starter Digihood

    (@josif201)

    matephorcreations, can you please send me your email address, so I can send you login details to my website?

    Plugin Author metaphorcreations

    (@metaphorcreations)

    @josif201 You can connect with me through the form at the bottom of this page: https://www.metaphorcreations.com/

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘url redirect’ is closed to new replies.