How to change post status from frontend?

There isn’t much native functionality in WP to apply admin powers on front end. Front-end Editor plugin is usually great for such, but changing post status is one feature it seems to lack (maybe it’s worth suggesting to scribu). So you are basically stuck with writing this from scratch – implementing JS on front end …

Read more

All, published and pending order

Filter views_edit-post. function tst($a) { // var_dump(get_defined_vars()); $tst = array(); $tst[‘future’] = $a[‘future’]; $tst[‘publish’] = $a[‘publish’]; $tst[‘all’] = $a[‘all’]; return $tst; } add_filter(‘views_edit-post’,’tst’); You can juggle that new array however you want. The only keys that are present in the incoming array are the one that have posts so you should check that the key …

Read more

Change post status based on user role

I’m then trying to figure out how to change the post status once their subscription is up function downgrade_user_role( $entry, $subscription_id, $transaction_id, $new_payment_amount ) { $user = GFUserData::get_user_by_entry_id( $entry[‘id’] ); $user->set_role( ‘subscriber’ ); global $wpdb; $wpdb->query( $wpdb->prepare( “UPDATE $wpdb->posts SET post_status=”draft” WHERE post_author = %d AND post_status IN (‘publish’, ‘future’)”, $user->ID ) ); } add_action( …

Read more