ERR_CONNECTION_RESET on post save or add media

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

Generate Post Title From ACF Fields on Custom Post Type

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

Why would I get a “Trying to access array offset on value of type bool” warning when using “metadata_exists()” in save_post?

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

How to automatically update ACF field value every year?

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

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