How to set Post ID from context to an attribute in child block of Gutenberg Query Loop
How to set Post ID from context to an attribute in child block of Gutenberg Query Loop
How to set Post ID from context to an attribute in child block of Gutenberg Query Loop
Can I display text that’s generated by a hook in another place in the HTML?
get_footer hook fires before the footer template file is loaded. Note: This hook is best to use to set up and execute code that doesn’t get echoed to the browser until later in the page load. Anything you echo will show up before any of the markup is displayed. Besides, make sure you call the … Read more
Thesis Theme -> hooks not working for custom function
get_term_by() returning null on plugin
getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
I found a solution: function my_function_to_run_on_autoupdate(array $results ): void { // Iterate through the plugins being updated and check if ours is there. foreach ( $results[‘plugin’] as $plugin ) { if ( isset( $plugin->item->slug ) && strlen( $plugin->item->slug ) > 0 // ‘your-plugin-slug’ is usually the folder name of your plugin && $plugin->item->slug === ‘your-plugin-slug’ … Read more
There’s several misunderstandings about how WordPress works here. I noticed that most examples of add_image_size() is done via the after_setup_theme hook. Which means, for it to register, one has to switch theme and reactivate the theme. Firstly, that’s not what it means. The after_setup_theme hook runs on every page load after the theme has been … Read more
The sample code function jon_save_post_webhook($post_id, $post) { // Check to see if autosaving etc., if so ignore if ($post->post_status !== ‘publish’) { return; } if ($post->post_status !== ‘trash’) { return; } /// rest of code Will always return early because while $post->post_status can be “trash” or “publish”, it can never be both at the same … Read more
Right before image subsizes are created, there’s a filter called intermediate_image_sizes_advanced that lets you modify the list of sizes. Here’s code that you could expand on — right now it just removes the thumbnail as a proof of concept: function remove_image_sizes_before_generation( $new_sizes, $image_meta, $attachment_id ) { $width = $image_meta[0]; $height = $image_meta[1]; // … Calculate aspect … Read more