wp_query ‘s’ parameter does not work with custom post type

You can do like this, $args = array( ‘post_type’ => ‘tribe_events’, ‘post_per_page’ => get_option(‘posts_per_page’), ‘s’ => get_search_query() ); $query = new WP_Query($args); // Use new keyword and you need to use WP_Query not Wp_Query while($query->have_posts()): $query->the_post(); the_title(); endwhile;wp_reset_postdata(); I used this in search.php file. Worked without any problem.

Display posts from #6 to #20 on archive page

Add offset in the query and give value as 5 so, the first 5 will be skipped. Below is code snippet for the same $custom_args = array(‘post_type’ => ‘your custom post type name’, ‘posts_per_page’ => ’20’, ‘orderby’ => ‘id’, ‘offset’=>5, ‘order’ => ‘ASC’,); $custom_query = get_posts($custom_args); foreach ($custom_query as $value) { //your data }

How can I remove “”

The default Shortcode will add that markup when necessary and only if the active WordPress theme didn’t enable HTML5 support for the gallery Shortcode’s markup/output. Or, in rare cases, a plugin or a custom code may have disabled the support. So an easy way to get rid of that <br> tags, is by enabling HTML5 … Read more

Checking is user author of number of posts?

I guess count_user_posts is what you’re looking for 😉 This is how you use it: $user_post_count = count_user_posts( $userid , $post_type ); And it returns the number of published posts the user has written in this post type. PS. And if you want some more advanced count, get_posts_by_author_sql can come quite handy.

How much of my site can I recover from public_html?

All site content for your WordPress site is stored in the database. The files that query and display the data, store settings, etc, are in the theme and plugin folders. There is the wp-config.php file that stores access credentials for your database. And media files are stored in the wp-content folder, but media files locations … Read more

Get posts by multiple ID’s (query)

Did you look at the documentation for WP_Query? The p parameter takes only a single integer. Use post__in. $args = array( ‘post__in’ => array( 206, 189 ), ‘post_type’ => ‘product’, );

Only display posts after current date

Turns out meta_query was the way to go. This is the code I used to make it work. add_action( ‘pre_get_posts’, ‘filter_posts’ ); function filter_posts( $query ) { $now = date(“Y-m-d H:i”, strtotime(‘+2 hours’)); if( is_category() && !is_admin() && $query->is_main_query() ) { $query->set( ‘posts_per_page’,’10’ ); $query->set( ‘orderby’,’meta_value_num’ ); $query->set( ‘meta_key’,’date-start-custom’ ); $query->set( ‘meta_query’, array( array( ‘key’ … Read more

Post update RSS notification plugin

First this is clearly not a bug. Feeds generated by WordPress are ordered by post publication date, which is both intended and makes sense. Second RSS clients uniquely identify items. In specific case of WP feeds unique identifier is guid field with non-pretty (?p=xxx) permalink. Even if post is changed and brought back into feed … Read more