ACF_Admin_Field_Groups::page_row_actions
Customizes the page row actions visible on hover.
Method of the class: ACF_Admin_Field_Groups{}
No Hooks.
Returns
Array.
Usage
$ACF_Admin_Field_Groups = new ACF_Admin_Field_Groups(); $ACF_Admin_Field_Groups->page_row_actions( $actions, $post );
- $actions(array) (required)
- The array of actions HTML.
- $post(WP_Post) (required)
- The post.
Changelog
| Since 5.9.0 | Introduced. |
ACF_Admin_Field_Groups::page_row_actions() ACF Admin Field Groups::page row actions code ACF 6.0.4
public function page_row_actions( $actions, $post ) {
// Remove "Quick Edit" action.
unset( $actions['inline'], $actions['inline hide-if-no-js'] );
// Append "Duplicate" action.
$duplicate_action_url = $this->get_admin_url( '&acfduplicate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
$actions['acfduplicate'] = '<a href="' . esc_url( $duplicate_action_url ) . '" aria-label="' . esc_attr__( 'Duplicate this item', 'acf' ) . '">' . __( 'Duplicate', 'acf' ) . '</a>';
// Append the "Activate" or "Deactivate" actions.
if ( 'acf-disabled' === $post->post_status ) {
$activate_deactivate_action = 'acfactivate';
$activate_action_url = $this->get_admin_url( '&acfactivate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
$actions['acfactivate'] = '<a href="' . esc_url( $activate_action_url ) . '" aria-label="' . esc_attr__( 'Activate this item', 'acf' ) . '">' . __( 'Activate', 'acf' ) . '</a>';
} else {
$activate_deactivate_action = 'acfdeactivate';
$deactivate_action_url = $this->get_admin_url( '&acfdeactivate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
$actions['acfdeactivate'] = '<a href="' . esc_url( $deactivate_action_url ) . '" aria-label="' . esc_attr__( 'Deactivate this item', 'acf' ) . '">' . __( 'Deactivate', 'acf' ) . '</a>';
}
// Return actions in custom order.
$order = array( 'edit', 'acfduplicate', $activate_deactivate_action, 'trash' );
return array_merge( array_flip( $order ), $actions );
}