PostTypes
PostTypes copied to clipboard
Create custom actions
Provide the ability to create custom bulk and row actions with PostTypes. An example of the API could be as follows, but needs further exploration.
// Create a basic event post type.
$event = new PostType('event');
// Create a 'Cancel Event' Bulk Actions
$event->actions()->bulk(
'cancel-event', // The unique action name.
__('Cancel Event'), // The action label.
function($redirect_url, $action, $post_ids) { // Callback to handle the bulk action request.
// Do stuff
return $redirect_url;
},
'upload_files' // Optional: Set the capability required to use the bulk action.
);