Hot answers tagged

3

You could encode them as JSON, or as serialized strings (the latter of which you can do using functions already baked in to Wordpress). Both of these options will let you keep the number of database rows down. However, both of these options will also significantly hamper your ability to search the data, or deal with it meaningfully in other ways if you need ...


3

If we look at the WP_REST_Controller::get_collection_params() method, we can see the minimum is 1 and the maximum is 100: 'per_page' => array( 'description' => __( 'Maximum number of items to be returned in result set.' ), 'type' => 'integer', 'default' => 10, 'minimum' => 1, '...


3

You unserialize() it. Be aware that most WordPress functions will automatically unserialize() database content before using it. See, for example, the Used By list for maybe_unserialize(). This is by no mean an exhaustive list, I'm sure. But if you're retrieving data directly from the database -- because there's not a WordPress function to achieve what you ...


2

In a nutshell your needs are completely unsupported by WP API. Taxonomies in WP are a grouping mechanism. Their primary purpose is to query set of objects, belonging to a group (term) or groups. There is no reverse operation to provide a set of objects and inquire which groups (terms) it belongs to. On top of that your logic requires additional hop to meta ...


1

As discussed in the comments, your database prefix settings are off-kilter. Check the database prefix actually in use in your database, and make sure it's the same as the one in wp-config.php. Also make sure all of your WordPress-related tables have the same prefix. You'll also need to search through your database, particularly in the _options table, as ...


1

Two things, at least: It looks like you need to declare the global $wpdb and you're using $wpdb->insert() incorrectly. The insert() method doesn't take your SQL query but a list of variables. It then create the SQL for you. See here You can execute SQL directly but it's a different process.


1

The obvious method would be to write a custom WP-CLI script to run through the table, extract the first and last names, use sanitize_title to create a new nicename and update the record. You'd also need to copy the first and last names in wp_usermeta as you mention, at the same time. I'm not sure I'm telling you anything you don't already know here.



Only top voted, non community-wiki answers of a minimum length are eligible