Tag Info

New answers tagged

0

If the only thing you care about are the posts, then you can export the posts and import them to a new DB. I am not sure if the built-in exporter stores the post IDs and attachments therefor you might end up needing to write your own, which if you care only about post content should not be too hard. The problem is that you should not really use an internal ...


0

That post ID is used to cross-link data across many different tables by the WordPress Core, plus whatever plugins might do or whatever the theme might do. There is also potential to break links if your site has ever used ?p= permalinks. So yes, this is a very dangerous idea. To properly reset your post ID's you are going to be in for a lot of work, but ...


0

Found a great solution. Basically, you can check if an option name exists and if it already exists you don't insert your data. The main idea is, each time your database schema changes and requires an update on your user’s database, you need to increment the DB_VER by 1, then write a database upgrade routine for the current DB_VER. This would create some ...


0

Add a check when the plugin is activated to see if the data(column/table) already exists in db or not ? If the data aldready exists then skip the db part and just mark the plugin as active.


1

Bulk of WP's native data structures aren't meant for direct MySQL access. They are typically accessed via PHP APIs which take care of MySQL generation/execution and many more things, such as allowing to filter data, caching it for performance, and so on. Your issue here is that from MySQL point of view meta values aren't related to each other, but only to ...


1

This will create a new admin user called username with password: password in a database called DATABASE Try this: First create a row in wp_users. Replace DATABASE with your database name, username with your choosen username, password with your password of choice. INSERT INTO `DATABASE`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, ...


1

Generally, WordPress has functions to handle what you want, it is much preferable to use them. For example, because it isn't a complete list, some of those are: wp_delete_user() wp_create_user() wp_insert_user() wp_update_user() The class behind (most of) it is: WP_User If you really need to know the SQL that is used, I would suggest you read the ...


1

As @Charleston Software Associates mentioned, the DESCRIBE query should not be executed if the table doesn't exist. The best solution, as he pointed out, is to prevent the error from occurring in the first place. To do so, patch wp-admin/includes/upgrade.php as follows: Change the following line from dbDelta(): $tablefields = ...


1

You can use Wp function for this. wp_delete_user(); this function work with user id. you can get all subscribers user id with this way: get_users() getting your filtered users. $get_subscribers = get_users('role=subscriber'); foreach($get_subscribers as $user){ wp_delete_user($user->ID); }


0

Don't you mean this query: "SELECT post_id FROM like WHERE user_id = %d ORDER BY id DESC" where we assume that the id column is unique and increase with each like.


-2

probably i = int a:3 = array[3] s:7 = string(7) etc



Top 50 recent answers are included