Articles of mysql

Search and replace in post content

I am about to change themes on my site and also a plugin that creates tabs with a post. I need to replace multi-line text with other multi-line text and can’t work out how to do it. I have tried “/r/n” but that doesn’t seem to work. Here is an example: I need to replace […]

PHP code inside shortcodes

Basically, I have this line of code: <?php echo do_shortcode(‘[O_U user_name=”operator” blocked_message=”This page is restricted for guests.”] **Content Goes here** [/O_U]’); ?> Now, inside Content Goes here I use regular HTML to create my content. But, now, I need to add some php inside that HTML. Right now, I need to populate the option for […]

Custom Plugin For Converting CSV To MySQL

I wrote a plugin to add a csv file to the database. I created a custom table to use. My file path looks like this, wuno-uploader/wuno-uploader.php wuno-uploader/inventory.csv On an settings option page in the admin dashboard I have a button. When the button is pressed and submitted it runs my code with no errors. I […]

How do i fix? WordPress database error: You have an error in your SQL syntax;

I am Using WordPress for making a website and getting below Error only on my pages and No shortcodes are working due to this error. This error ONLY seen on PAGES they are working fine on POSTS. I don’t know the solution of this error please help me out. I am new to wordpress. Error: […]

What happens if I overwrite the current wp_options table with a backup from a week ago?

I have a rather silly situation. I tried this query UPDATE wp_options SET option_value = ‘a:0:{}’ WHERE option_name = ‘active_plugins’; which disabled all my plugins. I was testing some issues on my site and this was the only solution to disable them. I had no wp admin access. The problem is that after I add […]

What are the issues associated with upgrading MySQL for WordPress?

What are the issues associated with upgrading MySQL from 5.1 up to 5.5 for a server hosting multiple WordPress sites? Will there be problems with the database after the upgrade? I have Plesk 12 installed on a Ubuntu server and I can update to the latest version of MySQL (I believe only 5.5) but I […]

Changing Table Prefix for an Existing WordPresss Site

Hoping someone can assist with WordPress table prefix for an already established site. What is the best approach in changing the existing table prefix within both DB and wp-config file to reflect new table prefix. Actually, it’s more the backend DB changes required. Is there a decent plugin or can someone pls point me to […]

How to remove 'GROUP BY' from SQL query produced from get_posts?

WordPress, Archive Cateory page. From default WP_Query->get_posts() we are getting something like this: SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (5) ) AND wp_posts.post_type = ‘post’ AND ((wp_posts.post_status = ‘publish’)) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 40 I want to remove this: […]

Query All users that has post

I have this query so far : $user_args = array( ‘role’ => ‘frontend_vendor’, ‘orderby’ => ‘display_name’, ‘order’ => ‘ASC’, ‘number’ => $no, ‘offset’ => $offset ); $user_query = new WP_User_Query( $user_args ); Now what I want to do is to get all users that has only posts, i have an example query that i want […]

Add user data to table when user is created?

I am trying to figure out how to add user information and specific meta data to a separate table through PHP. I would prefer to do this when a user posted to the wp_users and wp_usermeta table. I am using the WooCommerce Auction plugin and the Salient theme. Also if I made a PHP file […]