Forums

Where is the post grabbed by the contents in the permalink? (3 posts)

  1. SteveYantz
    Member
    Posted 1 year ago #

    If anyone has any info to help me out that would be great.
    I need to find the location where the post is grabbed by the contents of the url.
    So for instance, you have an id, or a postname. It collects those from the permalink and finds the post unique to that info.
    I need to create a new logic to grab the post by combining the category and a custom field.

    The only thing I'm asking is the location where this process happens. Help?

  2. Agus Suhanto
    Member
    Posted 1 year ago #

    You can use get_posts() function by supplying argument: array('category' => 1, 'meta_key' => 'your_key', 'meta_value' => 'your_key-value'). Replace the category, meta_key, and meta_value with your own values.

  3. SteveYantz
    Member
    Posted 1 year ago #

    as a permalink? I think you misunderstood my question.
    I'm trying to allow myself a new permalink structure without having the id, or postname in the permalink, and still have it work.

    My structure:
    http://www.site.com/futurama/1
    futurama is the category.
    1 is a custom field inside the wp_post's database table.

    I can get away with this structure showing up, but it returns no post, unless of course I include an id, or a postname into the structure.
    My conclusion is that there's somewhere that understands the permalink and looks for the id or postname to display a post for that permalink.
    I want to go into that function and add a new one, that searches for category + custom field, and grabs the post based on the combination of these restrictions.

Topic Closed

This topic has been closed to new replies.

About this Topic