Full migration to the WordPress REST API
In this release, Vimeotheque Lite moves away from the legacy admin-ajax.php-based architecture and adopts native WordPress REST API endpoints. This makes the plugin more robust, easier to debug, and better aligned with how WordPress core evolves.
The following actions have been migrated to REST:
cvm_get_videos→ GET/vimeotheque/v1/videoscvm_import_video→ POST/vimeotheque/v1/video/importcvm_import_video_thumbnail→ POST/vimeotheque/v1/video/<id>/thumbnailcvm_import_videos(bulk list view) → POST/vimeotheque/v1/videos/bulk-import
Each endpoint is protected with capability checks such as edit_posts and upload_files, and responses are standardized via WP_REST_Response and WP_Error, providing more predictable and consistent error handling.
Modern JavaScript and Backbone integration
The JavaScript layer behind the manual import grid has been significantly refactored. All previous jQuery.ajax() calls have been replaced with wp.apiFetch, which brings native support for REST authentication and automatic handling of the X-WP-Nonce header.
Backbone models and collections have been updated to communicate directly with REST endpoints:
BaseModelandBaseCollectionnow use REST URLs instead ofajaxurl.VideoModelandVideosCollectionwere refactored to work with the new REST response shape:
{ results, page, end, videos }
Legacy sync() overrides that relied on emulateJSON and forced POST requests have been removed. The result is a cleaner, more transparent data flow between the client and the server.
Smarter bulk import from the List View
Bulk import from the WordPress List View screen now uses the REST API endpoint
/vimeotheque/v1/videos/bulk-import.
The client-side script:
- Normalizes
cvm_import[]checkbox values into a proper JSON array for REST. - Sends a structured payload including
action_top/action2when applicable. - Displays clear success and error messages in the admin UI.
On the server side, the bulk import routine returns detailed statistics for each operation:
- Number of videos imported successfully.
- Number of videos skipped (for example, when a video already exists).
- Number of private videos.
- Number of errors encountered during the process.
An additional safeguard has been added: if no videos are selected in the List View, the plugin prevents the import and shows a clear message that at least one item must be chosen.
Improved thumbnail import with Gutenberg support
The thumbnail import workflow has been rewritten to use the REST endpoint
/vimeotheque/v1/video/<id>/thumbnail, replacing the old admin-ajax implementation.
Gutenberg (block editor)
Inside the block editor, the “Import Vimeo image” button now calls the REST API and, on success, updates
the Featured Image using:
wp.data.dispatch( 'core/editor' ).editPost({ featured_media: attachment_id });
The integration is seamless and keeps the Featured Image block in sync with the imported Vimeo thumbnail.
Classic editor
For the classic editor, the thumbnail import script has been turned into a standalone module that no longer depends on the manual import grid. It:
- Uses the same REST endpoint as Gutenberg.
- Displays clear success or error messages below the button.
- Resets its status message automatically after a short delay.
UI and UX refinements
Several user interface elements in the admin import screens have been updated to reflect the new REST-based
behavior:
- Grid messages, loaders and result counters now rely on REST response data.
- Empty search queries are flagged, preventing unnecessary requests.
- Bulk import attempts with zero selected videos show a direct, user-friendly warning.
- Deprecated AJAX-refresh logic has been removed from Backbone views to reduce complexity.
Performance and reliability improvements
Moving away from admin-ajax.php brings tangible performance benefits. REST requests avoid some
of the overhead involved in loading the entire admin environment on every call.
- Removed redundant JSON encoding/decoding previously necessary for
emulateJSON. - Eliminated forced
POSThacks for non-read calls. - Reduced server load by using lightweight REST endpoints instead of generic AJAX handlers.
- Made error and success responses easier to log, debug and monitor.
Codebase modernization and TypeScript adoption
This release also modernizes the internal code structure of Vimeotheque Lite:
- Legacy scripts have been gradually rewritten in TypeScript for better type safety and maintainability.
- Implicit global dependencies such as
Backbone,_andajaxurlhave been reduced or removed where possible. - A consistent transpilation pipeline ensures compatibility with current WordPress admin environments.
- Modules have been decoupled to avoid cross-dependencies, for example the thumbnail import script now lives as an independent component.
Bug fixes
This version includes several important fixes identified during the migration:
- Fixed fatal errors during thumbnail rendering by loading the required WordPress admin includes.
- Corrected inconsistent server responses that previously relied on a
response.successwrapper. - Improved handling of duplicate video imports (videos that already exist are now clearly reported as skipped).
- Resolved pagination issues caused by the old admin-ajax response format.
- Ensured REST calls correctly include the
X-WP-Nonceheader where authentication is required. - Fixed parameter mismatches in List View imports involving
action_topandaction2.