Best way to search and replace within serialized database strings?

It seems WP-CLI is indeed one of the easiest ways to search/replace serialized strings, e.g. for replacing any unwanted instances of staging links: wp search-replace https://staging.example.com https://example.com –all-tables The above command will search the entire WordPress database for the first string, and replace all instances with the second string provided. If you want to test … Read more

SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta

You can do something like Query the wp_posts table Left join the source_name from wp_posmeta table Left join the coverage_url from wp_posmeta table Then select the data you want to pull from post, source_name and coverage_url result Something like this should do SELECT post.ID, post.post_title, sn.meta_value as source_name, cu.meta_value as coverage_url FROM wp_posts as post … Read more

Server database problem

I believe Rarst is right. It sounds like you need to configure the wp-config.php file for the new database. Just go to the cpanel or other control panel of your hosting service, and use the address they use for the host address. If the database is on the same server as the web site, localhost … Read more

How to STOP wordpress trying to update database?

There is a DO_NOT_UPGRADE_GLOBAL_TABLES constant that going by documentation protects tables that are global in multisites (since they can grow large because of that), but I don’t see a clean way to prevent upgrade altogether. I’d work on getting that core clean of hacks instead.

Restrict users viewing post using age on database [closed]

There are probably a few ways to do this. The easiest way I can think of is to install Pods Framework. You can install it through the WordPress repository like you’d normally install a plugin, or through GitHub. Using Pods, you can extend the WordPress user database to add a birthday field. You can also … Read more

Problem with form database connectivity

You’re inserting raw POST data straight into an SQL query – sanitize, sanitize, sanitize! The code below should get you started, but I would advise you add some additional checks (is the email valid? are the strings too long? etc.): <?php $errors = $values = array(); if ( isset( $_POST[‘Submit’] ) ) { $fields = … Read more