I've been looking for minutes how to pass arguments in the register_deactivation_hook
as follow :
register_deactivation_hook( __FILE__, array( new Cpt, 'delete_cpt') ) );
class Cpt
{
/**
* Delete a custom post type
*/
public function delete_cpt($name = 'test') {
/**
* delete a single data
*/
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$GLOBALS['wpdb']->delete(
'cpt',
array(
'name'=>$name
)
);
$GLOBALS['wpdb']->show_errors();
echo $GLOBALS['wpdb']->last_query;
echo $name;
die();
}
}
The function executes but the $name
var remains empty.
I would like to pass the $name
directly in register_deactivation_hook
;
Is it at least possible ? Nothing seen anywhere.