Extending search query with additional $sentence value

Gladly I’ve written two plugins for that yesterday: Filter/Core That’s what a search query part looks like inside the posts_search filter: ‘ AND (((wp_XX_posts.post_title LIKE ‘%test%’) OR (wp_XX_posts.post_content LIKE ‘%test%’))) ‘ where wp_XX_ is just the $wpdb->prefix for my WPSE test site inside my local MU installation. Plugin #1 – drop searching post types that … Read more

Ordering posts by day (not time) AND meta value

This is what I’ve found. I’m using a filter to filter the ORDER BY on the SQL query generated by WP_Query. The filter is this posts_orderby. And with it, you can write a custom ORDER BY for the query. I’m gonna show you an example. add_filter(‘posts_orderby’, ‘posts_orderby’); function posts_orderby($orderby_for_query) { $orderby_for_query = “LEFT(wp_posts.post_date, 10) DESC, … Read more

$wpdb and MySQL Create Trigger

In the question you linked to, the solution was to use mysqli_multi_query as the API for executing the SQL. $wpdb desen’t have an API to do a multi query therefor you can’t use it directly, but you can get the handle to the mysql interface from $wpdb->dbh and do something like $sql_trigger = “….”; mysqli_multi_query($wpdb->dbh,$sql_trigger);

Is it possible to define two databases for one installation?

What you’re talking about is a database fallback. It’s possible to set something like this up, but not directly with WordPress. How it would work Instead of accessing the database directly, you’d access a proxy. This proxy would sit in front of both your primary and backup databases and pass traffic through. Essentially, it would … Read more

Scanning Database for malicious Data

I’ve read that dumping the database as text and searching in it is a good way to go. You can search with phpmyadmin, but it’s limited. Depends on the size of the database and a good text editor, but you can delete post/page revisions before dumping the database to bring it down in size. Or … Read more