Hey visitors! If you’re a beginner in WordPress and WP-CLI development, then you should check out my dear friend Bhargav’s Youtube channel! @BuntyWP

How to add/edit a post title programmatically in WordPress Gutenberg?

The post title is part of the Post Editor data, stored in the core/editor data store.

To add/edit the post title, we will make use of the editPost action in the following way:

wp.data.dispatch( 'core/editor' ).editPost( { title: 'This is the post title' } );Code language: TypeScript (typescript)

That’s it. You can try this command in the browser’s developer console as seen in the video below:



Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

Powered by WordPress