Update plugin settings option_name for big plugin update

I think changing array keys is more of a PHP problem // Get entire array $plugin_options = get_option( ‘plugin_options’ ); $new_options = array(); if( isset( $plugin_options[‘ga_accountId’] ) ) $new_options[‘ga_account_id’] = $plugin_options[‘ga_accountId’]; // Update entire array update_option( ‘plugin_settings_general’, $new_options ); // Delte old array delete_option( ‘plugin_options’ ); Any end-user who might be using using your plugin’s … Read more

Copying blog from root to /folder (Not moving)

Copy all of the files to the new folder. For the database, you’ll need to use something like PHPMyAdmin to export the current database as a .SQL file. Edit the .SQL file you downloaded to remove the first statements specifying what database to use (it will be “USE database”). You’d then need to create a … Read more

WordPress SQL – How to Check for Category?

And I want to add an additional condition that the post be in a specific category. Any thoughts? JOINing on the taxonomy tables is complicated. Unless you have a good reason why you have to use SQL, don’t. Use WP_Query. $args = array( ‘post_type’ => $holder, ‘numberposts’ => -1, ‘post_status’ => array(‘publish’), ‘category_name’ => ‘cat-slug’, … Read more

A change in URL slug in database returns 404, how can I do auto-redirect?

If you look in the database in the $wpdb->postmeta table you will see a meta_key named _wp_old_slug. That is how WordPress tracks slug changes. By editing the database directly you bypassed the mechanisms that create that postmeta entry. You never want to edit the database directly if you can use WordPress Core functions instead. Attempting … Read more

How do I convert all custom_field php timestamps in the database to js timestamps?

ACF using milliseconds is not standard for timestamps, and nor is it useful. How much accuracy do you need? Bear in mind that converting to something like yyyymmdd will not accommodate timezones. If you have access to PHPMyAdmin (or similar) and know your way around SQL, running a quick query would probably be the easiest … Read more