Managing two editable fields in gutenberg

Editable has been replaced with RichText in 2.2. Here’s a example of two RichText components being edit/saved together: const { __ } = wp.i18n; const { registerBlockType, RichText, } = wp.blocks; registerBlockType( ‘wtv/wtv’, { title: __( ‘wtv’, ‘wtv’ ), icon: ‘id’, category: ‘widgets’, keywords: [ __( ‘wtv’ ), __( ‘wtv’ ), __( ‘wtv’ ) ], … Read more

Adding pre-publish checks with Gutenberg

This got me started. Set up the block with create-guten-block Gitub Update block.js to something like: import ‘./style.scss’; import ‘./editor.scss’; var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel; var registerPlugin = wp.plugins.registerPlugin; function Component() { wp.data.dispatch(‘core/editor’).lockPostSaving() //do stuff //wp.data.dispatch(‘core/editor’).unlockPostSaving() return wp.element.createElement( PluginPrePublishPanel, { className: ‘my-plugin-publish-panel’, title: ‘Panel title’, initialOpen: true, }, ‘Panel content’ ); } registerPlugin( ‘my-plugin’, { render: … Read more

Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?

Your menu slug (5th parameter) can’t be the same across multiple pages, and it obviously can’t have an & in it, but you can have all the pages you want call the same callback function (the last param). add_submenu_page(‘upload_manage’, “Programs”, “Programs”, ‘manage_options’, ‘manage-programs’, “manage_data”); add_submenu_page(‘upload_manage’, “Schedule”, “Schedule”, ‘manage_options’, ‘manage-schedule’, “manage_data”); Then in the manage_data function, … Read more

Which to use to execute code during the saving of a plugin settings page?

If you’re using Settings API, then you should use a sanitize callback: register_setting( $option_group, $option_name, $sanitize_callback ); The myth is that the $sanitize_callback actually is a filter for your options when it’s saved in the database. This is the place where you can do something with your custom code. This is the sample code: register_setting( … Read more

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