WordPress.org

Support

Support » Plugins and Hacks » Hacks » Search post how do not have "moretag"

Search post how do not have "moretag"

Viewing 1 replies (of 1 total)
  • The SQL query to do this is:

    SELECT *
    FROM wp_posts
    WHERE post_content NOT LIKE '%<!--more-->%'
    AND post_status = 'publish'
    AND post_type = 'post'

    Substitute the “wp_” with your prefix or if using $wpdb use $wpdb->posts .You can’t use WP_Query alone because NOT LIKE is not supported. You could use WP_Query to set up everything else, then use the ‘posts_where’ filter to add in the NOT LIKE clause. This way you can paginate the results. Using the SQL query and $wpdb would mean you’re on your own for pagination.

Viewing 1 replies (of 1 total)
  • The topic ‘Search post how do not have "moretag"’ is closed to new replies.