media_row_actions
Filters the action links for each attachment in the Media list table.
Использование
add_filter( 'media_row_actions', 'wp_kama_media_row_actions_filter', 10, 3 );
/**
* Function for `media_row_actions` filter-hook.
*
* @param string[] $actions An array of action links for each attachment. Includes 'Edit', 'Delete Permanently', 'View', 'Copy URL' and 'Download file'.
* @param WP_Post $post WP_Post object for the current attachment.
* @param bool $detached Whether the list table contains media not attached to any posts.
*
* @return string[]
*/
function wp_kama_media_row_actions_filter( $actions, $post, $detached ){
// filter...
return $actions;
}
- $actions(string[])
- An array of action links for each attachment. Includes 'Edit', 'Delete Permanently', 'View', 'Copy URL' and 'Download file'.
- $post(WP_Post)
- WP_Post object for the current attachment.
- $detached(true|false)
- Whether the list table contains media not attached to any posts.
По умолчанию: true
Список изменений
| С версии 2.8.0 | Введена. |
Где вызывается хук
media_row_actions
wp-admin/includes/class-wp-media-list-table.php 874
return apply_filters( 'media_row_actions', $actions, $post, $this->detached );