Duplication function
-
Hi,
I used this duplication function
http://rudrastyh.com/wordpress/duplicate-post.html
to achieve the ability to duplicate post from the front-end.The modification I did doesn’t seems to be the right way to integrate such a thing in WordPress
This is what I did:-
-Change the function so it accepts one parameter rd_duplicate_post_as_draft($post_id)
-Remove the checking for the post/get etc if (! ( isse….
-Remove the redirect code (stopped working!/error)
-Add return new post id (didn’t help)
-Removed the second function which add the duplicate link to wp-adminThen in the page template I want to add the button/link I added the same stuff from the original function at first which checks the posts/gets values if ( isset( $_GET[‘post’]) || …..
then I call the function in function.php
$new_post_id = rd_duplicate_post_as_draft($post_id);The duplication link reload the same page + passing the 2 arguments
Issues:-
I cant redirect to the new duplicated page (header already set…)
The parameters stays on the address bar which means refreshing = new duplication!What is the right way to integrate duplication function on the frontend?
- The topic ‘Duplication function’ is closed to new replies.