Share Target

Share Target

Wordpress plugin

Install on Wordpress

App Details

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. For certain use-cases, e.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

With both plugins active, once you visit your site on a capable device and browser, you should see a prompt (via the PWA plugin’s functionality) to add the plugin to your home screen (e.g. similar to an app on your phone).

Once you have added your website to the home screen of your device, it should be available as a target when sharing any content from that device, e.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. If you are sharing a media file (e.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:

wp_enqueue_script( 'my-share-target-handler', '/assets/js/my-share-target-handler.js', array( 'share-target' ) ); 

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

wp.shareTarget.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. const spotifyRegex = /^https:\/\/open\.spotify\.com/; wp.shareTarget.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. if ( link && link.match( spotifyRegex ) ) { wp.data.dispatch( 'core/block-editor' ).insertBlocks( [ wp.blocks.createBlock( 'core/embed', { url: link, type: 'rich', providerNameSlug: 'spotify', responsive: true, } ), ] ); return true; } // Otherwise fall back to other handlers. return false; }, priority: 5, } ); 

Pricing

Starting from $0 per month.

Check Out the Skill Flip Cards Widget

By Common Ninja

Skill Flip CardsTry For Free!

App Info

Rating

Reviewers

No reviews

Tags

image
media
sharing
web

Developed By

Felix Arntz

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Skill Flip Cards for Wordpress logo

Skill Flip Cards

Use skill flip cards to showcase your abilities in a clear, interactive format that strengthens your profile and improves your chances of getting hired.

All in One Reviews for Wordpress logo

All in One Reviews

Display and manage customer reviews from multiple platforms in one place to build trust and highlight brand credibility.

Pricing Tables for Wordpress logo

Pricing Tables

Add pricing tables to your site to present plans clearly, help visitors compare features, and guide them toward faster and more confident conversions.

Consent Form for Wordpress logo

Consent Form

Create consent forms that collect signatures, save submissions, send notifications, and help you manage approvals efficiently.

Event Listings for Wordpress logo

Event Listings

Create event listings with an events board widget that displays upcoming activities clearly, helps visitors discover events, and supports easy management.

Nudge Button for Wordpress logo

Nudge Button

Nudge button with a subtle shaking animation that draws attention to important calls to action, increases interaction, and helps boost conversions.

Bluesky Feed for Wordpress logo

Bluesky Feed

Show Bluesky posts with a Bluesky feed that updates in real time, improves content discovery, and keeps visitors engaged with fresh activity.

Glossary for Wordpress logo

Glossary

Create an interactive glossary that displays clear definitions, images, and search options to help visitors learn terms quickly and navigate complex topics with ease.

Flip Card Builder for Wordpress logo

Flip Card Builder

Add interactive two-sided cards with flip effects to present front and back content in a compact, engaging format.

Company Branch Flip Cards for Wordpress logo

Company Branch Flip Cards

Display locations with company branch flip cards that help customers find nearby offices, understand key details, and enjoy a smoother overall experience.

Telegram Chat for Wordpress logo

Telegram Chat

Add Telegram Chat to your site to communicate with visitors, deliver instant support, and provide a smoother, more reliable user experience.

TikTok Feed for Wordpress logo

TikTok Feed

Show your latest TikTok videos in a live feed that keeps content fresh, builds social proof, and keeps visitors engaged.

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms