Add configurable Quick Create mode for translations#609
Merged
lloc merged 12 commits intolloc:masterfrom Apr 20, 2026
Merged
Conversation
Add activate_quick_create checkbox to the Advanced Settings section, allowing users to enable silent translation creation without leaving the current post.
Register msls/v1/create-translation POST endpoint. Creates a draft translation post on the target blog with mapped taxonomies and MSLS links. All data is filterable via dedicated hooks.
Add a '+' button per language when no translation is linked. In classic mode it opens post-new.php in a new tab. When Quick Create is enabled, it calls the REST API and updates the UI in place.
Add tests for permission check, source not found, and successful translation creation. Update existing test expectations for new setting count.
Add uglify step for msls-quick-create.js and fix PHPStan issue in MslsRestApi taxonomy lookup.
Quick Create now applies everywhere the '+' icon appears: post listing columns and the metabox. The logic lives in MslsAdminIcon::get_a() so both contexts use the same code path. Updated setting label and allowed data attributes in wp_kses.
Replace <a href="#"> anti-pattern with a semantic <button> element. Reset button styles via CSS, add aria-label for accessibility, and replace the button with an <a> edit link on success.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a 'Quick Create' feature for the Multisite Language Switcher plugin, allowing users to generate draft translations with a single click. The implementation includes a new REST API endpoint, frontend logic for asynchronous requests, and administrative settings. Review feedback highlights a security vulnerability where source post permissions are not verified, a missing return type hint in the REST callback, and several opportunities for defensive programming, such as verifying the existence of post types and taxonomies on target blogs to improve robustness.
Add read_post capability check on source blog to prevent content leaking. Verify post_type exists on target blog before inserting. Guard against empty post IDs in link map iteration.
This was referenced Apr 15, 2026
Move the 'From xx:' prefix from prepare_post_data into a public static filter callback registered on msls_quick_create_post_data. Consumers can now remove_filter to disable the prefix or replace it.
The WordPress plugin check requires the translators comment on the line directly above the __() call, not above the sprintf().
The 'From xx:' prefix breaks markup when applied to post_content. Only prefix post_title by default. Content is copied as-is from the source post.
4 tasks
lloc
approved these changes
Apr 20, 2026
Owner
|
Thanks for working on this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #608
Summary
post-new.phplink with a REST API callPOST msls/v1/create-translationendpoint creates a draft post on the target blog with mapped taxonomies and MSLS linksMslsAdminIcon::get_a()msls_quick_create_post_data,msls_quick_create_tax_input,msls_quick_create_after_insert,msls_quick_create_responseDetails
From [lang]:, statusdraft, mapped categories/tags<button>element witharia-labelfor the Quick Create triggerTest plan
post-new.phpas beforecomposer test— 403 tests pass