Juliepr Media Defaults
Set useful defaults for Image and YouTube Embed blocks in the WordPress block editor
by Sergei Ashmarin · github.com/sashmarin/juliepr-media-defaults · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/sashmarin/juliepr-media-defaults/archive/refs/heads/main.zipMinimal WordPress plugin for the Gutenberg core/image and YouTube Embed blocks.
For each Media Library image it uses the original file, centres the block, links to that media file, preserves the source proportions, and saves its width at 50% of the source width. The browser calculates the height from the original proportions. After the first adjustment, it adds the juliepr-adjusted-media class; blocks with this marker are not changed again, even when an author changes their settings manually.
Development
There is no build step or PHP dependency. Install this folder in a WordPress site's wp-content/plugins/ directory, activate the plugin, and test in the block editor.
Settings
Open Settings → Media Defaults in wp-admin. Each Image block default can be disabled independently. The settings page also provides an opt-in checkbox to delete the plugin's settings when the plugin is deleted.
YouTube Embed blocks receive centre alignment, the juliepr-media-youtube-landscape class, and the same juliepr-adjusted-media marker. Its CSS declarations are editable on the settings page. The same page provides a juliepr-media-youtube-portrait utility class for videos that need a portrait presentation; add that class manually when needed.
Localization
English is the source language. Russian is bundled as a native WordPress 6.5+ PHP translation catalog at languages/juliepr-media-defaults-ru_RU.l10n.php; no legacy .mo file is used.
Manual checks before a release:
- Insert a new Image block and choose a Media Library image with known dimensions, such as 2400 × 1600.
- Confirm the image URL and its link both use the original file, alignment is centre, the Aspect ratio control says Original, and the saved block has
width="1200px". - Reopen a post containing an existing Image block and confirm it receives the defaults and
juliepr-adjusted-media; save the post. - Change that marked block manually, reopen the post, and confirm the manual change remains intact.