Does WP REST API cache internally executed (rest_do_request) requests?

Does WP REST API cache internally executed requests? No it does not, not out of the box. CDNs and caching plugins can and do interfere however, especially for unauthenticated REST requests. As an example to demonstrate this with hard results and test my own conclusion I added a random number generator to my site: https://tomjn.com/wp-json/tomjn/v1/random … Read more

Custom rewrite, url path with parameters to a page

Your code seems to work fine with slight modifications. Taken from here: https://developer.wordpress.org/reference/functions/add_rewrite_rule/#comment-content-4787 First off, I moved the rewrite rules to init and modified the regex to match parameters optionally: function wse_414800_rewrite_state_city() { add_rewrite_rule( ‘^(pluginpage)/([^/]*)/([^/]*)/?’, ‘index.php?pagename=pluginpage&state=$matches[2]&city=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘^(pluginpage)/([^/]*)/?’, ‘index.php?pagename=pluginpage&state=$matches[2]’, ‘top’ ); } add_action(‘init’, ‘wse_414800_rewrite_state_city’); And, to be able to retrieve our custom query … Read more

Why is WordPress wrapping search for users that looks like integers with asterisks and how do I fix it?

The search term was getting surrounded by asterisks. Yes, and they are wildcard characters, and in the case of the Users list table at wp-admin/users.php, those asterisks are being added by wp-admin/includes/class-wp-users-list-table.php (see source on GitHub for WordPress v6.1), so that a LIKE ‘%<keyword>%’ query is performed by default. So to fix the issue, yes, … Read more

Is it within WordPress guidelines to update another plugin’s database fields from my own plugin? [closed]

WordPress guidelines doesn’t restrict doing this. In fact, modifying database directly is no different from doing update_post_meta() or update_option() which are used widely everywhere. However, modifying data of other plugins need to be done carefully because the data might be referred somewhere else. I’d recommend using the plugins’ hooks to get/change the data instead of … Read more

React Plugin Settings Page Localization

adds an admin menu page with a div that React replaces, but the localization inside this React doesn’t work Actually, since you are enqueueing the same script (build/index.js), which is automatically registered by register_block_type(), then in your my_enqueue_admin_scripts() function, just do wp_enqueue_script( ‘my-block-local-editor-script’ ) to enqueue/load the script on your admin menu page. And secondly, … Read more

register_activation_hook doesn’t execute without add_action(‘init’,’some-function’)

The register_activation_hook() function takes two parameters: the first parameter is the path to the main plugin file, and the second parameter is the name of the function to be executed when the plugin is activated. In your case, you are passing the plugin directory path to the register_activation_hook() function instead of the path to the … Read more

esc_url, esc_url_raw or sanitize_url?

This might be a more useful demonstration: <a href=”<?php echo esc_url( $url ); ?>>I’m printing a URL to the frontend</a> $url = sanitize_url( $_GET[‘user_inputted_data’] ); update_post_meta( $post_id, ‘that_url’, $url ); esc_url is an escaping function, sanitize_url is a sanitising function. Sanitising functions clean incoming data, e.g. removing letters from phone numbers, stripping trailing space etc. … Read more

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