WordPress.org

Ready to get started?Download WordPress

Forums

How does pre_get_posts work? (4 posts)

  1. Bigs
    Member
    Posted 6 years ago #

    Some of my blog entries have the following field.

    'article' = 1

    I do not want these to be displayed on my home page and I am hoping the pre_get_posts action can stop this.

    There is an article here

    http://codex.wordpress.org/Custom_Queries

    But i can't work out what is going on. Can this action be used to solve my problem?

  2. MichaelH
    Member
    Posted 6 years ago #

    Can't address your pre_get_posts question, but what is causing that text to display.

    Is that text in your Post, or is that a Custom Field?

  3. Bigs
    Member
    Posted 6 years ago #

    Sorry, the article = 1 isn't being displayed.

    The question was whether I could modify a query some how to identify this optional field and remove it.

    After some Googling I have managed to remove a category from my blog roll. It wasn't exactly what I was after but it has done the trick.

  4. Kafkaesqui

    Posted 6 years ago #

    I put up a plugin here that lets you limit posts on the home page based on custom field data:

    http://wordpress.org/support/topic/93438

    It [should] be trivial to update it so it offers an option to *not* display certain posts based on a custom field. That is, if you're interested...

Topic Closed

This topic has been closed to new replies.

About this Topic