update_post_meta doesnt update template

What’s the problem of this code? You incorrectly called get_page_by_path() whereby if you want to specify the post type (the third parameter), then you need to specify the second parameter as well which is the return type and defaults to OBJECT. So: // Wrong: Missing the return type (second parameter). // Or I mean, the … Read more

WordPress shortcode using WPB_GET_IP

See the accepted answer at ServerFault: […] if a request is chained through more than one proxy server, then each proxy should add the IP of the preceding one to the existing X-Forwarded-For header so that the entire chain is preserved. X-Forwarded-For: <client>, <proxy1>, <proxy2>, …

Why WP_Screeen doesn’t show all options with admin_body_class

But parent_base is set to null. Yes, because by the time admin_body_class is fired, WordPress hasn’t yet set the parent_base value. And it’s only set after the <body> tag is actually outputted. More specifically, it’s set only after the <div id=”wpbody” role=”main”> as you can see here in wp-admin/admin-header.php. Any idea how to add class … Read more

wp_schedule_event custom event time

I use the following code to run a task. this doesn’t require adding a cron schedule. function setup_my_action() { if (!wp_next_scheduled(‘my_action’)) { wp_schedule_single_event(time()+3600, ‘my_action’); } } function my_action() { // do something } add_action(‘init’,’setup_my_action’); add_action(‘my_action’, ‘my_action’);

Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection

After tons of digging it appears that the way the error message is worded was a bit misleading. Refused to load https://www.service-domain.com/ because it does not appear in the frame-ancestors directive of the Content Security Policy. What isn’t clarified above is that it wasn’t the server/site I was working on that Refused to load from … Read more