Override base Gutenberg block default spacing in child theme’s theme.json

Use a Global Styles Filter to override the style: add_filter( ‘wp_theme_json_data_default’, function ( $theme_json ){ $new_data = array( ‘version’ => 2, ‘styles’ => [ ‘blocks’ => [ ‘core/embed’ => [ ‘spacing’ => [ ‘margin’ => [ ‘top’ => ‘2rem’ ] ] ] ] ] ); return $theme_json->update_with( $new_data ); }); An alternative that may also … Read more

Get the email of the author of the currently being edited post in Gutenberg frontend

Here’s how can you get the ID and email address of the author of the currently being edited post: // Get the post author’s ID. let postAuthorId = wp.data.select( ‘core/editor’ ).getCurrentPostAttribute( ‘author’ ); /* or you can also use this: let postAuthorId = wp.data.select( ‘core/editor’ ).getEditedPostAttribute( ‘author’ ); */ // Get the post author’s email. … Read more

Setting “Open in New Tab” for Link Control to be checked by default

You have to watch editor changes, you can hook the js to ‘enqueue_block_editor_assets’. your-child-theme/js/default-open-in-new-tab.js wp.domReady(() => { //console.log(“Custom script loaded”); const { subscribe } = wp.data; //we want to subscribe to changes of the editor // Helper function to determine if a URL is external const isExternalLink = (url) => { try { const domain … Read more

Moving Post Title out of Block Editor

When using the block editor, Is there a way to move the post title out of the block editor interface? No, but you could hide it with CSS and put a post title box in the post sidebar. You could even override its edit component with a blank component. But this would be problematic and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)