How to create 450 categories in wp

You can try using BulkPress. It allows you to create hundreds of categories very easily. Follow these steps: Install and activate the plugin. In the left side bar, hover your cursor on Bulkpress. Then click on Terms. A new page will appear. In Taxonomy field, choose Category. Insert your Categories in the Terms field. Choose … Read more

Extending the database

I’m not sure why you’re getting a 1. Your code says that you should not. However, it seems that what you’re doing is unnecessary and generally ill-advised. Modifying existing tables is usually not needed. The wp_comments table contains a comment_parent and user_id column. So if I reply to a comment, it’s immediate parent ID is … Read more

Jquery ajax to custom php file: returning blank data

You are going on the wrong way.This will create difficulties and is NOT WORDPRESS STANDARD.Wordpress has a ajax technique to implement this. Call the ajax from your page <script> var data = { ‘action’: ‘insert_data_customtable’, ‘first_name’: firstname, ‘last_name’: lastname }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php … Read more

query to create woocommerce products from images

I’d agree that doing this in SQL would be a lot more to learn than PHP. With WordPress functions you can run a query on all the images ( WP_Query ) and then loop through the results and use the info from the images to create a new post using [wp_insert_post()][2]. Finally you can update … Read more

Is deleting orphaned wp_options entries safe?

I have a wordpress site with some serious wp_options table bloating. This is causing slow page loads and memory bloat. After investigation, there appears to be thousands of orphaned entries. If you know for a fact these options are for plugins that are no longer in use, then yes it’s safe to delete them. If … Read more

How to Remove Two (Related) wp_postmeta Rows?

After 5 hours of searching finally I wrote the SQL query and that is- DELETE FROM {$wpdb->postmeta} WHERE post_id IN (SELECT post_id FROM (SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key LIKE ‘_thumbnail_id’ AND post_id IN(SELECT post_id WHERE meta_key LIKE ‘rafi’)) AS s) I saw your answer above, but using this kinda SQL query for this kinda … Read more

SQL Query to Get list of all users along with their blogs

You can use get_blogs_of_user() to get all the blogs of a given user. So to get a list sorted by the users: global $wpdb; $blogs = array(); $user_ids = $wpdb->get_col( ‘SELECT ID FROM $wpdb->users’ ); foreach( $user_ids as $user_id ) { $blogs[$user_id] = get_blogs_of_user( $user_id ); } // you can use var_dump( $blogs ); to … Read more

Delete post revisions on post publish

I think a small plugin with the hook ‘publish_posts’ is enough. But I dont know about a core function to delete revisions and I use a query with WP functions. The source is untested, written only for this post. <?php /** * Plugin Name: WPSE71248 Delete Revisions on Publish Posts * Plugin URI: http://wordpress.stackexchange.com/questions/71248/ * … Read more