WordPress plugin intelligence profile

Share Target

Allows to share images and other content directly to a WordPress site through the Web Share Target API.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 5.7
Current version1.0.0-beta.1
WordPress coverageTested up to WordPress 5.7
Minimum stackWP 5.2 · PHP 7.0
Directory statusactive
Last directory update6 Apr 20215y ago
Active installationsNewAdoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Share Target version 1.0.0-beta.1 as active, updated 5y ago and tested up to WordPress 5.7.

Overview

About this plugin

By using this plugin, you can share content like images, media, URLs and text directly to your WordPress site from a capable device and browser. For example, you can share a photo that you just took on your phone to your WordPress site in the same way that you would otherwise share it with your friends in a native messaging app.

When you share content to your WordPress site using this plugin, it will automatically start a new block editor draft post with it; you can then just add anything else you like, or immediately publish it as is. g. an image blog, creating a post with the shared image might be everything that’s needed before publishing right away!

To name a few other examples of what you can share to your WordPress site using this plugin, think about audio and video files, short text notes, Spotify playlists – basically anything that you can share from an app on your phone you can now also share directly to your WordPress site.

Requirements

In order to use this plugin, you will also need to install and activate the PWA plugin, which provides the basic infrastructure for your site to become a PWA.

Usage

g. similar to an app on your phone).

g. a photo or a URL.

When you share something to your WordPress site, the installed PWA of your website should open. You should then (potentially after logging in) land directly on a new post in the block editor where the shared content has already been added. g.

an image or video file), it will be automatically added to your site’s media library.

Background information

This plugin is powered by the Web Share Target API. The Web Share Target API is a modern browser API which allows sharing images, media, URLs and basic text content directly to your website, relying on the regular sharing UI that is for example integrated in your phone. See here for more technical background information about the Web Share Target API.

Third-party developer API

The Share Target plugin allows other plugins to integrate with it. You can customize what should happen with incoming shared content when it arrives in the block editor, conditionally overriding the default behavior of the plugin.

In PHP, enqueue your custom JavaScript file. Make sure to include the share-target script in its dependencies. For example:

js', array( 'share-target' ) );

In your JavaScript file you can then add your custom share handler using the following function:

registerShareHandler( options )

Registers a new share handler for incoming shared data.

Parameters:

  • options: (Object) (required) Handler options.
  • options.handle: (Function) (required) Share handler function. Must be asynchronous and accept an object with properties title, description, link (each strings), and attachment (object). Any of these may be undefined. Depending on the data, the function should decide whether to handle it and if so run the necessary logic and return true, to stop following handlers from being called. Otherwise, it should return false.
  • options.priority: (number) (optional) Priority for the handler. A lower number means higher priority, like for WordPress hooks. Default is 10.

The following example handles any shared Spotify content and embeds it into the post:

// Matches a shared Spotify URL. com/;

registerShareHandler( { handle: async ( { link, attachment } ) => { // Do not handle if a media file is being shared. if ( attachment ) { return false; }

// If a shared Spotify URL, embed it. createBlock( 'core/embed', { url: link, type: 'rich', providerNameSlug: 'spotify', responsive: true, } ), ] ); return true; }

// Otherwise fall back to other handlers. return false; }, priority: 5, } );

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • share target
  • image
  • media
  • sharing
  • web
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 5.7

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 5.7.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to5.7
Minimum requirementsWordPress 5.2 · PHP 7.0
Update activity6 Apr 20215y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.