The function as written there will succeed silently, since you haven’t actually passed in any data to change. You should be able to see what I mean by altering your function slightly:
function trigger_post_update( $post_id ) {
return wp_update_post( array( 'ID' => $post_id ), true );
}
You don’t need the get_post() to check if it exists, wp_update_post() will do that for you and return a WP_Error if it doesn’t (without the second parameter it will just return 0). On success the function will return the ID you passed in.
Related Posts:
- Add To Gutenberg Sidebar
- How to detect the usage of Gutenberg
- Possible to use @wordpress/create-block with multiple blocks?
- What is the advantage of ‘register_block_type’ (the PHP function) when creating custom blocks?
- The Block Editor: Disable “Color settings” in the specific block
- What replaces wpColorPicker in Gutenberg?
- Find all the places where a block type is used
- WP Blocks – Gutenberg – not rendering $content
- Why does the custom HTML block not preserve the HTML characters?
- Gutenberg change/remove “Write your story” placeholder in custom blocks
- How do I listen for a change in an innerBlock child?
- How to enable Gutenberg Block Editor on taxonomy term pages?
- What’s the absolute minimum code that I need to create a dynamic block?
- Custom Gutenberg Block: Excluding an allowed block from InnerBlock’s templateLock={‘all’}
- Determine if block has already been registered
- InnerBlocks breaks Flexbox and CSS Grid styles
- Is there a way to set the gutenberg color palette outside the theme?
- Gutenberg get withState variable in save function
- Gutenberg block JavaScript localisation on Polyglots does not work
- how define elements type in attributes type array of gutenberg blocks
- Convert GMT time to local time in Gutenberg Block Editor
- Restrict heading level in Gutenberg block `core/heading`
- How do I disable or hide the Layout block setting in the Group block
- Cleaning up after block dismount
- I cant see Block Editor with v5.7
- How to update block attribute after format is applied?
- How to add a class to the link of the default Gutenberg Button block?
- How to identify what templates are being loaded in a block-based theme [closed]
- Check if current page is using blocks (Gutenberg) or is legacy
- Add support for ‘alignnone’ to Gutenberg block align controls?
- How do I replace a audio gutenberg block to native audio wordpress
- Converting a theme to Gutenberg but some styles are missing in the front end [closed]
- How to disable align-wide for specified blocks in Gutenberg
- Deprecated function not working in Gutenberg
- Gutenberg Block checkbox check-unckeck does not work
- Gutenberg get index of gutenberg innerblock
- Custom Endpoint API based on attribute gutenberg block
- Gutenberg : how can I get the title of the current block within its ‘edit’ function?
- Gutenberg – Remove add block button
- Gutenberg programmatically move block to position
- Gutenberg somehow not loading in WP 5
- Gutenberg JavaScript error
- Gutenberg selecting child blocks directly from appender
- Image not aligning with text
- Custom validation on publish/ update in Block Editor
- WordPress Gutenberg – Open the “Block Pattern Explorer” programmatically
- Modify src attribute on image block
- Two text color palettes are appearing in Gutenberg
- WordPress Gutenberg – Sidebar get posts list based on selected category
- Gutenberg build error: You may need an appropriate loader to handle this file type SCSS
- Gutenberg: How to constrict floated table blocks to 1000px width in the front-end, when align wide & full are being used?
- Quasy – modal component does not hide itself
- Table block – Wrap table
- Whitelist a single SVG for use in post_content
- Gutenberg block previews suddenly not working
- WordPress Gutenberg Signal on Block Alignment Change
- When to use block patterns over nested blocks?
- How to convert block to a list block in WordPress gutenberg editor?
- How to do store, retrieve and write attributes in the registerFormatType method in Guttenberg?
- How can I create more advanced layouts in Gutenberg block editor?
- How to replace the Gutenberg default block with a custom block?
- Images are not shown in the post editor
- Get post ancestors in the Block Editor
- How to disable blocks in Gutenberg editor for specific post type
- Possible to make the link autocompleter prioritize Tags before Posts?
- Prevent FormTokenField component to accept random entries
- How to move the customizations done in the Editor to my child theme?
- Unable to see the attributes for the custom block created
- How to register multiple blocks
- How to edit post meta by post ID in Gutenberg
- How do I change bullet on categories block?
- Add a class to img of core/cover block
- Hide title block on edit screen in Gutenberg
- How can I disable fontSizes of the Paragraph block inside the Quote block with theme.json?
- Categories, tags and thumbnails panels are not visible in the Block editor’s post menu
- How to translate multiple blocks within one plugin
- How to disable the Code Editor in Gutenberg?
- Enable Gutenberg Editor when editing tags
- Get attributes from last block created
- How do I make the block editor use https by default?
- Custom Gutenberg block within column block selection and update issue
- WP Gutenberg – How to parse simple images?
- How to add button to Gutenberg Editing Toolbar in Wordress
- Restrict Block from having a Parent or Ancenstor Block
- Disable block editor pre-publish sidebar for custom post type
- I want to horizontally align items in multiple parallel columns under one column block
- Position tab missing in the Block Theme Editor
- Override base Gutenberg block default spacing in child theme’s theme.json
- Execute JavaScript code when your custom block is inserted
- How can I remove the H1 option from the gutenberg editor
- Adding a button to the format toolbar for custom styles
- How to “comment out” a block in WordPress (make it invisible without deleting it)?
- Query Loop block display multiple post types
- Align block editor
- Saving a meta value as an object using useEntityProp
- wp:query not responding to new settings
- Embeds (YouTube, Spotify) Work Live but Won’t Load in Block Editor [closed]
- How can I get rid of extra line space in this poetry stanza
- set allowedBlocks to a specific variant
- Add custom settings to standard Gutenberg blocks