Check that a valid id (other than 0) is received. The second function collects all the information from the post or page you want to copy and creates a draft with this data: title, author, metadata, taxonomy, text… It will only fail if it does not get the content identifier right, if the original content does not exist or if the insertion into the database was not possible. */add_filter( 'post_row_actions', 'insertar_boton_duplicar', 10, 2 ) //EntradasĪdd_filter( 'page_row_actions', 'insertar_boton_duplicar', 10, 2 ) //Paginas * The function is added to the list of actions for posts and pages. If(current_user_can('edit_posts'))$acciones='ID,basename(_FILE_),'clone_nonce').'" title="Duplicar este contenido" rel="">Duplicar' If the user has permissions to edit entries and pages, then the clone button can be displayed. */function insertar_boton_duplicar($acciones,$post) ** FUNCION 1: Adding the clone button to pages and posts This way, you won’t lose changes with major theme updates. If you don’t have it, it’s time to create a child theme. Specifically, alfunctions.php of your child theme. T he code I’ll show you below, you have to add it to your theme’s functions.php. The procedure is the same for both pages and posts. You’ll see that the “Duplicate” option will appear (as before). If you want to duplicate a post or entry on WordPress, go to: Posts > All Posts and hover over the entry you want to copy. You will see that the Duplicate option will appear.Ĭlick the button and you’re done! Your page has already been duplicated. If you want to clone a page on WordPress, go to: Pages > All Pages and hover over the page you want to copy. Once you have everything to your liking, click ‘Save’ and you’re done.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |