WordPress SQL LIKE request doesn’t work for fields with special symbols

What I miss here? How to search through any elements in this field? Your SQL statements, or the LIKE ‘%a%’ and LIKE ‘%full%’, are good. But the wpdb::prepare()‘s documentation says, “Literal percentage signs (%) in the query string must be written as %%“, hence you should actually use LIKE ‘%%a%%’ and LIKE ‘%%full%%’. But then … Read more

How To Write An Inner Join With WP Query

Ok so the way I was able to just show English properties on the user admin page was with this posts_request hook: add_filter(‘posts_request’, function($sql, $query) { $is_user_edit_page = ( isset($_SERVER[‘HTTP_REFERER’]) && strpos($_SERVER[‘HTTP_REFERER’], ‘user-edit’) !== false ); $is_property_sql = (strpos($sql, ‘property’) !== false); if ($is_user_edit_page && $is_property_sql) { $sql = str_replace(“‘sp'”, “‘en'”, $sql); } return $sql; … Read more

Moving database with phpMyAdmin

I would do this so. But this is probably not the most efficient way accomplishing this task. There are several plugins out there, that may automate this. If anyone knows one, that is good, I would like to hear about it. Plugins that look promising: http://wordpress.org/extend/plugins/xcloner-backup-and-restore/ http://wordpress.org/extend/plugins/duplicator/ http://wordpress.org/extend/plugins/wp-migrate-db/ Find more at: http://wordpress.org/extend/plugins/tags/backup

Custom Fields Bulk Edit

FIRST BACKUP!!!!! NEXT, BE SURE THE BACKUP IS RIGHT Now, you can use this code in PHPMyAdmin UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‘preview’, ‘edit’) WHERE meta_key = ‘dp_video_code’ Make sure that’s the correct name of the custom field, you can check it in the wp_postmeta table.

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)