What is the proper way to validate and sanitize JSON response from REST API?

Thanks to @GTsvetanov from Stackoverflow.com. Missing part of my code is $request->get_json_params(); for getting json request then compare it with schema using rest_validate_value_from_schema() then using rest_sanitize_value_from_schema() for saving proper data to database. $schema = $this->user_playtime_meta_schema(); $val = $request->get_json_params();//<– my mistake $result = rest_validate_value_from_schema( $values, $schema ); if ( ! is_wp_error( rest_validate_value_from_schema( $val, $schema ) ) … Read more

I’m designing a plugin to create database indexes. Suggestions?

This plugin, Index WP MySQL for Speed, is released. GPLed source code is here. Anecdotal experience shows speedups on some big WP and WooCommerce sites. Here’s the data definition language it runs to create useful compound indexes. ALTER TABLE wp_postmeta ADD UNIQUE KEY meta_id (meta_id); ALTER TABLE wp_postmeta DROP PRIMARY KEY; ALTER TABLE wp_postmeta ADD … Read more

SQL Query to Update Admin Email

While your SQL query will probably do the trick, you don’t need to interface directly with the database to accomplish this. The preferred methods would by using WordPress’ update_option() function or by running the WP-CLI command:wp option update. Via update_option() To override the admin email change confirmation process, add the following to your functions.php file … Read more

WP plugins for building a database?

WordPress natively stores content in a database. It sounds like you’re wanting to store info in that database, and retrieve and present it – rather than actually create a separate database. If that’s the case, creating custom post types are likely the way to go. An author can be a custom post type, which would … Read more

Critical error in final stage of website launch – URLs are BROKEN!

Posting as an answer from the @OneTrickPony comment above: Verify that mod_rewrite is enabled on your server. Assuming that mod_rewrite is enabled, ensure that the root WordPress install directory is WordPress-writeable, or that, if it exists, the .htaccess file in the root WordPress install directory is WordPress-writeable. (See file permission scheme for WordPress, and Hardening … Read more