Why does my custom slug only show in Gutenberg editor after page refresh?
Why does my custom slug only show in Gutenberg editor after page refresh?
Why does my custom slug only show in Gutenberg editor after page refresh?
The “ERR_CONNECTION_RESET” error in WordPress usually occurs when there is a server connection problem during the execution of a POST request, such as when saving a post or adding media. There can be many reasons behind this error, but here are some common solutions that can be tried: Check for Plugin/Theme Conflicts – Start by … Read more
I just wanted to post the code that got this working without issues. I had an extra argument in the function that was never being used ( $post ). function ccc_acf_update_fixture_post_title( $post_id ) { if ( get_post_type( $post_id ) == ‘fixture’ ) { $team = get_field( ‘team’, $post_id ); $venue = get_field( ‘venue’, $post_id ); … Read more
After the advice from every awesome person who helped, I finally got it to work. I just had to define $the_content instead of trying to use the hook get_the_content() alone. Now it’s tagging everything perfectly. Here is the final code for anyone who wants to use it in the future. Or you can just download … Read more
Thanks to mmm’s comment above, it was pointed out that even for CPTs the first parameter’s value needs to be “post”, as clearly stated in the documentation at https://developer.wordpress.org/reference/functions/metadata_exists/. Somewhere along the way I confused myself into thinking that the first parameter’s value needed to be the CPT handle for a custom post type (CPT), … Read more
If you don’t want to use a scheduler (ex: Action Scheduler) or a cron job, and you only want to update once per year, then an option that tracks the next update time is probably the simplest approach (untested): add_action( ‘init’, static function () { $option_name=”cpt_ages_next_update”; $option = absint( get_option( $option_name ) ); if ( … Read more
You can achieve this by using the wp_insert_post hook, which is called before the post is saved or updated. Inside this hook, you can check if the post ID exists to determine if it’s an update or a new post. Here’s how you can do it: add_action(‘wp_insert_post’, function ($post_ID, $post, $update) { if (!$update) { … Read more
Try adding this save function to see if it saves data function save_custom_artiesten_metabox_on_reload() { global $post; if (isset($_POST[‘oa_datum’]) && isset($_POST[‘oa_aanvang’]) && isset($_POST[‘oa_locatie’]) && isset($_POST[‘oa_toegang_prijs’])) { update_post_meta($post->ID, ‘oa_datum’, sanitize_text_field($_POST[‘oa_datum’])); update_post_meta($post->ID, ‘oa_aanvang’, sanitize_text_field($_POST[‘oa_aanvang’])); update_post_meta($post->ID, ‘oa_locatie’, sanitize_text_field($_POST[‘oa_locatie’])); update_post_meta($post->ID, ‘oa_toegang_prijs’, sanitize_text_field($_POST[‘oa_toegang_prijs’])); } } add_action(‘admin_init’, ‘save_custom_artiesten_metabox_on_reload’);
update ACF field when saving post on back office
You could for example save an error flag to a transient in save_post, if a required field is empty, and the display the admin notice based on the transient. This concept is demonstrated in in this old answer. Another option is to add a simple script to the editing view which would alert the user … Read more