friends_browser_extension_actions - akirk/friends GitHub Wiki
Allows plugins to register actions for the Friends browser extension.
Each action is an associative array with:
name(string, required) — label shown in the extension popup.url(string, required) — target URL; may contain{current_url}which the extension substitutes with the current page URL (URL-encoded).method(string, optional) — if"POST", the extension submits a form instead of opening a link.fields(object, optional) — for POST actions, key/value pairs of form fields; values may contain{current_url}(raw) and{page_html}placeholders.
Example
add_filter( 'friends_browser_extension_actions', function ( $actions, $current_user ) {
$actions[] = array(
'name' => 'Save to Collection',
'url' => home_url( '/collect/?url={current_url}' ),
);
return $actions;
}, 10, 2 );
Parameters
array$actionsThe array of actions.WP_User$current_userThe current user.
Returns
array The modified array of actions.
Files
apply_filters( 'friends_browser_extension_actions', array(), $current_user )