Plugin Docs
Everything you need to install, configure, and use the apiJAV WordPress plugin system โ server and client.
Introduction
apiJAV is a WordPress system that lets you host videos on one WordPress site and import and display them on another โ automatically, with full metadata, taxonomy support, and permanent embed URLs.
Client Plugin
My Video Public API โ connects to a server, lets you browse, import, and manage videos locally.
Bulk Import
Import thousands of videos by page range in one click. Duplicate detection is automatic.
Permanent Tokens
Embed URLs are generated with permanent tokens โ safe to store in your database forever.
How It Works
The system works as a source-destination pair. Your server site holds the original video posts. Your client site pulls them via REST API and creates local WordPress posts with all metadata preserved.
Server Site (My Video API Manager) โโ Hosts original video posts โโ Exposes REST API at /wp-json/myvideo/v1/ โโ Generates permanent embed tokens โ REST API calls over HTTPS Client Site (My Video Public API) โโ Browses server via admin panel โโ Imports posts with full meta + taxonomies โโ Stores embed URL permanently in post meta โโ Theme renders iframe from stored meta
Features
- Browse & Search โ filter by category, tag, actor, studio, date, views
- Bulk Import โ import by page range (e.g. page 26 โ 1), 1000 videos per page
- Import All โ one-click import of all available videos
- Duplicate Detection โ single SQL batch query checks thousands of IDs instantly
- Live Progress โ real-time progress bar, per-row status, pause/resume/cancel
- Auto Page Switch โ table view automatically follows the currently importing page
- Cache Control โ configurable transient cache + one-click clear
- Taxonomy Sync โ categories, tags, actors, studios all created locally on import
Client Plugin โ Installation
Install My Video Public API on the WordPress site where you want to import and display the videos.
Upload & Activate
Go to Plugins โ Add New โ Upload Plugin. Upload my-video-public-api.zip and activate.
Enter API URL
Go to Video API โ Settings and enter your server site's URL (e.g. https://your-server.com). Click Save, then Test Connection.
Start Browsing
Go to Video API โ Browse Videos. Your server's videos will load automatically.
Bulk Import
Go to Video API โ Bulk Import. Choose a filter, set your page range, and click Import All Pages.
Connecting to the Server
In Video API โ Settings, enter the full URL of your server site โ no trailing slash, no /wp-json path. The plugin appends the REST API path automatically.
โ Correct: https://myserver.com https://videos.example.com โ Wrong: https://myserver.com/ # trailing slash https://myserver.com/wp-json # don't add the path
| Setting | Description |
|---|---|
| api_url | Server site URL. Required. |
| per_page | Default posts per page for Browse Videos. Max 100. |
| cache_minutes | How long to cache API responses. 0 = no cache. |
Browse Videos
The Browse Videos page lets you search and filter the server's videos and import them one at a time.
- Search โ filter by keyword, category, tag, actor, studio
- Import button โ each card has an โฌ Import button. Already-imported videos show a green โ Imported overlay
- Batch check โ imported status is checked in a single database query per page load, not per video
- Preview โ click โถ Preview to open the player modal before importing
Bulk Import
The Bulk Import page lets you import thousands of videos with a single click. It runs sequentially โ one video at a time โ to avoid server overload.
Step 1 โ Choose Filter
Select a category, tag, and/or studio to narrow the import, or leave all blank to import everything. Set videos per page (up to 1000 if your server supports it).
Click Load Video Info to see the total video count and page count. This automatically clears any stale cache so you always get accurate numbers.
Step 2 โ Set Page Range
Set From Page and To Page. The import always runs from the highest page number down to the lowest โ meaning oldest-first, newest-last.
Or click โก Import All Pages to queue every page automatically.
Step 3 โ Start Import
Click โถ Start Import. The system will:
- Load all pages in the queue sequentially
- Check which videos are already imported (batch SQL query)
- Build a flat queue of only new videos
- Import them one by one with 150ms between each
- Auto-update the table view as each page completes
Import Speed
| Delay | When | Adjustable? |
|---|---|---|
| 150ms | Between each successful import | Yes โ edit page-bulk-import.php |
| 500ms | After a failed import (retry buffer) | Yes |
Import by ID
Go to Video API โ Import by ID to import a single video by its remote post ID. You can preview the player before importing.
Remote Post ID: 12345 โ Fetches from: https://server.com/wp-json/myvideo/v1/posts/12345 โ Creates local post with all meta + embed URL
Imported Posts
The Imported Posts page shows all locally imported videos. From here you can:
- Edit โ open the WordPress post editor
- Play โ open the embed URL in a new tab
- Refresh All Embeds โ re-fetches embed URLs from the server (only needed if server secret keys changed)
Meta Fields
Each imported post gets these WordPress post meta fields, which your theme can read:
| Meta Key | Content |
|---|---|
| embed | Full iframe HTML โ your ACF textarea field. Ready to output. |
| embed_url | Plain embed URL without iframe wrapper. |
| thumb | Thumbnail image URL. |
| post_views_count | View count from the source server. |
| likes_count | Like count from the source server. |
| dislikes_count | Dislike count. |
| hd_video | 'on' if HD, empty string if not. |
| code | Video code/ID from the server. |
| duration_hh | Duration hours component. |
| duration_mm | Duration minutes component. |
| duration_ss | Duration seconds component. |
| video_duration_combined | Full duration string, e.g. 01:23:45. |
| _mvapic_remote_id | Remote post ID โ used for duplicate detection. |
Example Theme Usage
// Output the embed in your single.php or template $embed = get_post_meta( get_the_ID(), 'embed', true ); if ( $embed ) { echo $embed; // outputs the full <iframe> tag } // Or get the plain URL $url = get_post_meta( get_the_ID(), 'embed_url', true ); $thumb = get_post_meta( get_the_ID(), 'thumb', true ); $views = get_post_meta( get_the_ID(), 'post_views_count', true );
Caching
API responses are cached using WordPress transients. The cache duration is set in Video API โ Settings.
- Browse Videos โ cached per unique filter combination
- Bulk Import โ always fetches fresh (cache bypassed)
- Embed URLs / Player โ never cached, always fresh
- Filter options โ cached 6 hours
To clear all cached data, go to Video API โ Settings โ Clear Cache. The Bulk Import "Load Video Info" button also clears the posts cache automatically before fetching.
Taxonomies
On import, the plugin maps server taxonomies to local WordPress taxonomies:
| Server Field | Local Taxonomy | Notes |
|---|---|---|
| categories | category (built-in) | Created if not exists |
| tags | post_tag (built-in) | Created if not exists |
| actors | actors (custom) | Must be registered by your theme |
| studio | studio (custom) | Must be registered by your theme |
actors and studio must be registered by your theme or a plugin before import. If they don't exist, those terms are silently skipped.FAQ
Why does the page count change after I change per_page?
The total page count is calculated as ceil(total_videos / per_page). With 25,631 videos at 1000/page you get 26 pages. At 100/page you get 257 pages. Always click Load Video Info after changing the per-page setting to get the updated count โ the button also clears stale cache automatically.
Can I run multiple bulk imports at the same time?
It's not recommended. Two parallel imports on the same site may cause duplicate detection to miss posts that are mid-import. Run one at a time.
What happens if an import fails midway?
Already-imported videos are safe โ they're in your database. The failed item shows a red โ Error badge. You can click Resume or re-run the same range โ all previously imported videos will be detected and skipped.
Are embed URLs permanent?
Yes. The server generates embed tokens that never expire. They are safe to store in your WordPress database permanently. The only reason to use Refresh Embeds is if the server's WordPress secret keys were regenerated.
My categories/tags dropdown is empty
Go to Video API โ Settings โ Clear Cache and then reload the Bulk Import page. The filter dropdowns sample up to 1,000 posts from the API โ if your server is new and has few posts, the lists may be sparse.