Problem with admin login after deployment

I suspect either the culprit is one of the plugins or the theme you are using. so, try: -deactivating ALL plugins temporarily to narrow down the problem. If the problem goes away, activate them individually (one-by-one) to find the problematic plugin. If you don’t have access to your admin area, try deactivating plugins manually via … Read more

Create a WordPress administrator without access to back-end

Run this script in phpMyAdmin or whatever tool you use to access MySQL: SET @user_login := ‘justin_foell’; SET @user_pass := ‘Q9xiHgzZ’; SET @user_email := ‘[email protected]’; INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_email`, `user_registered`) VALUES (@user_login, MD5(@user_pass), @user_email, now()); SELECT @user_id := LAST_INSERT_ID(); INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES (@user_id, ‘wp_capabilities’, ‘a:1:{s:13:”administrator”;b:1;}’); INSERT INTO `wp_usermeta` (`user_id`, … Read more

SQL Query in WordPress – Getting Impossible WHERE error

Look at your conditions: WHERE ( ( (meta_key=’user_school_subjects’ AND meta_value LIKE ‘%history%’) OR (meta_key=’user_professional_courses’ AND meta_value LIKE ‘%history%’) OR (meta_key=’user_language_tutoring’ AND meta_value LIKE ‘%history%’) OR (meta_key=’user_music_tutoring’ AND meta_value LIKE ‘%history%’) ) AND (meta_key=’user_gender’ AND meta_value=”male”)) There is no way that you can have a meta key matching one of these– user_school_subjects, user_professional_courses, user_language_tutoring, user_music_tutoring … … Read more

Query multiple tables at once?

SELECT * FROM wp_posts, wp_2_posts, wp_3_posts WHERE wp_posts.post_content LIKE ‘%foo’ OR wp_2_posts.post_content LIKE ‘%foo’ OR wp_3_posts.post_content LIKE ‘%foo’; should do the trick. (Note that in Multisite, there shouldn’t be a wp_1_posts — your root site uses wp_posts etc.)

after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()

prepare() takes at least 2 parameters. Most of your calls to prepare() are not needed. For example: $blogids = $wpdb->get_col($wpdb->prepare(“SELECT blog_id FROM $wpdb->blogs”)); In this code, if the call to $wpdb->prepare() were valid, it wouldn’t do anything. The function doesn’t do anything to the first parameter. It manipulates the values in the other parameters passed … Read more

Which is better and faster ? WordPress Queries or SQL Query

Queries ofcourse. It’s faster… But in this case just please delete you wp site and start with something faster… here is my superfast framework for you… <?php /*Your bunny wrote */ I did tests, 0.0000001 runtime vs WP usually 0.7-2.8 Sarcasm off P/S/ This question have no sence since using direct queries and output of … Read more

What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?

You can also do it this way – plugin free. Open phpmyadmin, browse over to your wp_posts table and: SELECT * FROM `wp_posts` WHERE post_type=”revision”; to see all the posts, their types and revisions and delete from `wp_posts` WHERE post_type=”revision” Though afraid at first…I did it. And it worked without any impact to the site.

pagination on data fetched using SQL query

<?php global $wpdb; // QUERY HERE TO COUNT TOTAL RECORDS FOR PAGINATION $total = $wpdb->get_var(“SELECT COUNT(*) FROM (SELECT * FROM muslim LIMIT 0,431) AS a”); $post_per_page = 10; $page = isset( $_GET[‘cpage’] ) ? abs( (int) $_GET[‘cpage’] ) : 1; $offset = ( $page * $post_per_page ) – $post_per_page; // QUERY HERE TO GET OUR … Read more