Redirect to edit newly duplicated entries

Installation: See https://github.com/gravitywiz/snippet-library/blob/master/gp-entry-blocks/gpeb-show-all-entries-to-admin.php

Code

Filename: gpeb-redirect-to-edit-after-duplicating.php

<?php
/**
 * Gravity Perks // GP Entry Blocks // Redirect to edit newly duplicated entries
 *
 * Installation:
 *  See https://github.com/gravitywiz/snippet-library/blob/master/gp-entry-blocks/gpeb-show-all-entries-to-admin.php
 */
add_action( 'gpeb_entry_duplicated', function( $entry ) {
	wp_safe_redirect( add_query_arg( array(
		'edit_entry' => $entry['id'],
	), GP_Entry_Blockscleaned_current_url() ) );
});

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.