cac/column/actions/action_links

Deprecated This documentation is deprecated since Admin Columns version 4.

The filter cac/column/actions/action_links filters the available actions in the Actions column. The actions column, by default, shows action links like “Edit”, “View” and “Delete”: this filters allows you to modify its behaviour, adding or removing action links or changing their order.

Usage

/**
 * Filter the action links for the actions column
 *
 * @param array $actions List of actions ([action name] => [action link]).
 * @param CPAC_Column_Actions $column_instance Column object.
 * @param int $object_id Post ID
 */
function my_cac_action_links( $actions, $column, $object_id ) {
    // Possibly modify $actions
    return $actions;
}
add_filter( 'cac/column/actions/action_links', 'my_cac_action_links', 10, 3 );

Examples

In this example we will add a Tweet this button to the actions links.

/**
 * Add a tweet this button to the actions links
 *
 * @param array $actions List of actions ([action name] => [action link]).
 * @param CPAC_Column_Actions $column_instance Column object.
 * @param int $object_id Post ID
 */
function my_cac_action_links_add_tweet_button( $actions, $column, $object_id ) {
    if ( 'post' == $column->get_storage_model_type() ) {
        $actions['button'] = '<a href="http://www.twitter.com/share?url=' . get_permalink( $object_id ) . ' target="_blank">' . __( 'Tweet this', 'mylang' ) . '</a>';
    }
    return $actions;
}
add_filter( 'cac/column/actions/action_links', 'my_cac_action_links_add_tweet_button', 10, 3 );