Admin Posts List (edit.php) by post IDs

It can be achieved using pre_get_posts. It is important to prefix all your variable names, id seems not be in the reserved terms list, but anyway this practice avoids any unforeseen bug. /** * Usage: * http://example.com/wp-admin/edit.php?my_pids=4088,4090,4092,4094 */ add_filter( ‘pre_get_posts’, ‘limit_post_list_wpse_96418’ ); function limit_post_list_wpse_96418( $query ) { // Don’t run on frontend if( !is_admin() ) … Read more

wpdb query problem to access previous 3 days posts

You are asking for the last three posts ordered by post date, not for the posts from the last three days– ORDER BY post_date DESC LIMIT 3. post_date has a time component to it. It is not just marked with a date. Even so, that LIMIT would restrict the query to last three in the … Read more

Searching With Apostrophe

Your question isn’t much of a WordPress related question, more like a MySQL question. But I have sort of a solution in my head: You could go with a custom query and a replace on the apostrophe: SELECT * FROM `table` WHERE REPLACE( `column`, “‘”, “”) LIKE REPLACE( ‘string’, “‘”, “” ) For a combined … Read more

How to fix pagination for custom loops?

The Problem By default, in any given context, WordPress uses the main query to determine pagination. The main query object is stored in the $wp_query global, which is also used to output the main query loop: if ( have_posts() ) : while ( have_posts() ) : the_post(); When you use a custom query, you create … Read more