WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/shortcut link

Description

The shortcut_link filter is applied to the "Press This" bookmarklet URL before it is returned by get_shortcut_link().

Usage

Create a "Press This" button for a custom post type called example.

function press_this_ptype($link) {
	$post_type = 'example';

	$link = str_replace('post-new.php', "post-new.php?post_type=$post_type", $link);
	$link = str_replace('?u=', '&u=', $link);

	return $link;
}
add_filter('shortcut_link', 'press_this_ptype', 11);

Change Log

Since: 2.6.0

See Also