Created
April 4, 2017 18:12
-
-
Save musamamasood/b380f0c02fa248a178c355135fa56ecf to your computer and use it in GitHub Desktop.
Plugin To Disabled the Ninja Form Trash Submission after 30 days.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Solution to disable the auto cleaning of trash submission in Ninja forms. | |
* http://ryansechrest.com/2013/09/prevent-wordpress-automatically-purging-trash-custom-post-type/ | |
* | |
* @param $post_id | |
*/ | |
function do_not_schedule_post_types( $post_id ) { | |
// array of post_type you don't want to be scheduled | |
$unscheduled_post_types = array( 'nf_sub'); | |
if ( in_array( get_post_type( $post_id ), $unscheduled_post_types ) ) { | |
delete_post_meta( $post_id, '_wp_trash_meta_time' ); | |
} | |
} | |
add_action ( 'trashed_post', 'do_not_schedule_post_types' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment