Skip to content

Actions and filters

Admin: 10 hooks.

Every hook here has a description in the source.

2 actions8 filters

action

davo_add_adminbar_submenu

Adds a submenu item in the top of the admin bar.

Parameters of davo_add_adminbar_submenu
ParameterTypeDescription
$wp_admin_barWP_Admin_BarAdmin bar instance to add the menu to.
$menu_identifierstringThe menu identifier.
add_action
add_action( 'davo_add_adminbar_submenu', 'my_action_callback', 10, 2 );

/**
 * @param WP_Admin_Bar $wp_admin_bar
 * @param string $menu_identifier
 */
function my_action_callback( $wp_admin_bar, $menu_identifier ) {
	// Your code here.
}

src/admin/admin-bar-menu.php:95

filter

davo_get_revision_ui_diff

Filters the fields displayed in the post revision diff UI.

Parameters of davo_get_revision_ui_diff
ParameterTypeDescription
$returnarray[]Array of revision UI fields. Each item is an array of id, name, and diff.
$compare_fromWP_PostThe revision post to compare from.
$compare_toWP_PostThe revision post to compare to.
add_filter
add_filter( 'davo_get_revision_ui_diff', 'my_filter_callback', 10, 3 );

/**
 * @param array[] $return
 * @param WP_Post $compare_from
 * @param WP_Post $compare_to
 */
function my_filter_callback( $return, $compare_from, $compare_to ) {
	// Change $return as needed, then return it.
	return $return;
}

src/admin/ajax/post-revisions-diff-data.php:400

filter

davo_manage_options_capability

Filter: 'davo_manage_options_capability' - Allow changing the capability users need to view the settings pages.

Parameters of davo_manage_options_capability
ParameterTypeDescription
$capabilitystringThe capability.
add_filter
add_filter( 'davo_manage_options_capability', 'my_filter_callback', 10, 1 );

/**
 * @param string $capability
 */
function my_filter_callback( $capability ) {
	// Change $capability as needed, then return it.
	return $capability;
}

src/admin/admin.php:90

filter

davo_post_editor_placeholder

Filters the body placeholder text of the post editor.

Parameters of davo_post_editor_placeholder
ParameterTypeDescription
$placeholderstringPlaceholder text. Defaults to "Start typing or use / for commands".
$post\WP_PostThe post being edited.

Returns string

add_filter
add_filter( 'davo_post_editor_placeholder', 'my_filter_callback', 10, 2 );

/**
 * @param string $placeholder
 * @param \WP_Post $post
 */
function my_filter_callback( $placeholder, $post ) {
	// Change $placeholder as needed, then return it.
	return $placeholder;
}

src/admin/ajax/post-editor-settings.php:73

filter

davo_post_editor_title_placeholder

Filters the title placeholder text of the post editor.

Parameters of davo_post_editor_title_placeholder
ParameterTypeDescription
$placeholderstringPlaceholder text. Defaults to "Add title".
$post\WP_PostThe post being edited.

Returns string

add_filter
add_filter( 'davo_post_editor_title_placeholder', 'my_filter_callback', 10, 2 );

/**
 * @param string $placeholder
 * @param \WP_Post $post
 */
function my_filter_callback( $placeholder, $post ) {
	// Change $placeholder as needed, then return it.
	return $placeholder;
}

src/admin/ajax/post-editor-settings.php:89

filter

davo_prepare_revision_diff_data_for_js

Filters the array of revisions used on the revisions screen.

Parameters of davo_prepare_revision_diff_data_for_js
ParameterTypeDescription
$revisions_dataarray{ The bootstrapped data for the revisions screen. @type int $id Revision ID. @type string $title Title for the revision's parent WP_Post object. @type int $author Revision post author ID. @type string $date Date the revision was modified. @type string $dateShort Short-form version of the date the revision was modified. @type string $timeAgo GMT-aware amount of time ago the revision was modified. @type bool $autosave Whether the revision is an autosave. @type bool $current Whether the revision is both not an autosave and the post modified date matches the revision modified date (GMT-aware). @type bool $canRestore Whether revision can be restored or not. }
$revisionWP_PostThe revision's WP_Post object.
$postWP_PostThe revision's parent WP_Post object.
add_filter
add_filter( 'davo_prepare_revision_diff_data_for_js', 'my_filter_callback', 10, 3 );

/**
 * @param array $revisions_data
 * @param WP_Post $revision
 * @param WP_Post $post
 */
function my_filter_callback( $revisions_data, $revision, $post ) {
	// Change $revisions_data as needed, then return it.
	return $revisions_data;
}

src/admin/ajax/post-revisions-diff-data.php:175

filter

davo_prepare_revision_for_js

Filters the array of revisions used on the revisions screen.

Parameters of davo_prepare_revision_for_js
ParameterTypeDescription
$revisions_dataarray{ The bootstrapped data for the revisions screen. @type int $id Revision ID. @type string $title Title for the revision's parent WP_Post object. @type int $author Revision post author ID. @type string $date Date the revision was modified. @type string $dateShort Short-form version of the date the revision was modified. @type string $timeAgo GMT-aware amount of time ago the revision was modified. @type bool $autosave Whether the revision is an autosave. @type bool $current Whether the revision is both not an autosave and the post modified date matches the revision modified date (GMT-aware). @type bool $canRestore Whether revision can be restored or not. }
$revisionWP_PostThe revision's WP_Post object.
$postWP_PostThe revision's parent WP_Post object.
add_filter
add_filter( 'davo_prepare_revision_for_js', 'my_filter_callback', 10, 3 );

/**
 * @param array $revisions_data
 * @param WP_Post $revision
 * @param WP_Post $post
 */
function my_filter_callback( $revisions_data, $revision, $post ) {
	// Change $revisions_data as needed, then return it.
	return $revisions_data;
}

src/admin/ajax/post-revisions.php:151

action

davo_register_capabilities

Fires when capabilities are registered, so a domain can add its own through the Capability_Manager.

add_action
add_action( 'davo_register_capabilities', 'my_action_callback', 10, 1 );

function my_action_callback( $arg1 ) {
	// Your code here.
}

src/domains/tickets/roles-capabilities.php:298, and 2 more places

filter

davo_show_post_locked_dialog

Filters whether the post-locked dialog is shown when another user is already editing the post.

Parameters of davo_show_post_locked_dialog
ParameterTypeDescription
$showboolWhether to show the dialog. Default true.
$post\WP_PostThe post being edited.
$user_idintThe user who holds the lock.

Returns bool

add_filter
add_filter( 'davo_show_post_locked_dialog', 'my_filter_callback', 10, 3 );

/**
 * @param bool $show
 * @param \WP_Post $post
 * @param int $user_id
 */
function my_filter_callback( $show, $post, $user_id ) {
	// Change $show as needed, then return it.
	return $show;
}

src/admin/ajax/post-editor-settings.php:131

filter

davo_submenu_pages

Filter: 'davo_submenu_pages' - Collects all submenus that need to be shown.

Parameters of davo_submenu_pages
ParameterTypeDescription
$submenu_pagesarrayList of all submenu pages.
add_filter
add_filter( 'davo_submenu_pages', 'my_filter_callback', 10, 1 );

/**
 * @param array $submenu_pages
 */
function my_filter_callback( $submenu_pages ) {
	// Change $submenu_pages as needed, then return it.
	return $submenu_pages;
}

src/admin/menu/admin-menu.php:101

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first