Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to have a custom post type which has 'Activate' and 'Deactivate' rather than 'Publish' and 'Move to Trash'. Once a post is deactivated, the user can go and delete it permanently.

This functionality is required due to the nature of the custom post type. Is it possible to disable the emptying of trash (by default 30 days) for this particular custom post type, so that the 'deactivated' posts will remain there and not be cleaned up?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

If I understand your question correctly I just came across a similiar situation in a test project I'm working on.

I just added a custom meta field active and none active as a checkbox. When I get my posts on the pages I filter on this meta field aswell.

So on the live website I only show published posts who also have the custom checkbox active. If not I don't show them. But in the backoffice all those posts are threated as live posts.

Would this approuch be what you are looking for? If wanted I can provide some code examples, although this should be quite clear.

-- for trash you can do this. There is a constant named EMPTY_TRASH_DAYS you could Set EMPTY_TRASH_DAYS to a very high number.

 define( 'EMPTY_TRASH_DAYS', 1000000 );

btw this goes in your wp-config.php

I found this also here http://wordpress.stackexchange.com/a/7761/17541 seems like you can remove the shedule action.

function my_remove_schedule_delete() {
    remove_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
}
add_action( 'init', 'my_remove_schedule_delete' );
share|improve this answer
    
Yes this can also work, but adds an extra layer on top of the WordPress Published/Draft system, which I was hoping I could repurpose into Activated/Deactivated, exactly the way plugins work in WordPress. –  drtanz Aug 20 '12 at 13:17
    
Ok, I have no idea if you can hook into that functionality. I added a little more info about the trash situation to my answer above –  woony Aug 21 '12 at 7:05
    
Removing scheduled delete would be nice, but I need to know if we can specify the deletion of that particular post type, rather than all deletions. –  drtanz Aug 21 '12 at 10:45
    
I do not think that will be possible. Your easiest solution remains my first suggestion I think. –  woony Aug 21 '12 at 12:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.