Content Security Policy blocking images from installed plugins’ popup info window, as they are from external domains – global fix?

The answer, as mentioned in a comment by @JacobPeattie, was to add the domains to my .htaccess file where I am setting the CSP Headers, (turns out most plugins’ “View Details” link loads images from ps.w.org, which I just learned). A few other plugins loaded images from other domains, so I also added each of … Read more

Fix CVE-2017-5487 vulnerability

When WordPress enabled the REST API in Core in version 4.7 it enabled the endpoint /wp-json/wp/v2/users/ to list all users that have posted something to the site. Therefore that endpoint can be used by an attacker to find some or all of the administrator account usernames to target for password cracking which is a potential … Read more

How to add a nonce check correctly to this specific code?

The first thing is to inline the nonce so that you can use it in the script that calls the ajax action. // plugin or theme php file wp_enqueue_script( ‘your-script-handle’, ‘url/to/your/script.js’, array( ‘jquery’ ), null, true ); wp_add_inline_script( ‘your-script-handle’, ‘const YourAjaxConfig = ‘ . json_encode( array( ‘ajax’ => array( ‘url’ => admin_url( ‘admin-ajax.php’ ), ‘action’ … Read more

Is it a good idea to restrict the REST API

You can use the rest_dispatch_request filter to catch the /wp/v2/users routes before they deliver their data to the user. add_filter( ‘rest_dispatch_request’, ‘wpse425815_authenticate_user_route’, 10, 4 ); /** * Forces authentication on the wp/v2/user route(s). * * @param mixed $result The current result. * @param WP_Request $request The REST request. * @param string $route The requested route. … Read more

Verify Cryptographic Authenticity after Downloading Releases (Signatures)

If you downloaded the latest version then your download URL would have been: https://wordpress.org/wordpress-6.5.3.zip You can find the md5 hash for this file by adding .md5 to the end of that URL, like this: https://wordpress.org/wordpress-6.5.3.zip.md5 The md5 hash for this file is: ad3b0a21dec368341d64906e86db49f7 So, theoretically, you should be able to get the md5 hash of … Read more

how to sanitizing $_POST with the correct way?

Instead of looping through the array, use this: map_deep( $form_data, ‘sanitize_text_field’ ); (see the User Notes in the function doc: https://developer.wordpress.org/reference/functions/sanitize_text_field/ ) The docs state that Checks for invalid UTF-8, Converts single < characters to entities Strips all tags Removes line breaks, tabs, and extra whitespace Strips percent-encoded characters So you could also use the … Read more

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