WordPress: Getting URL link for archive based on custom field filter

I am trying to provide a link on a wordpress post that will lead the user to an archive view with other posts with the same custom field.

In other words, something much like get_author_posts_url, but get_customfield_posts_url.

Read More

Thanks in advance!

Related posts

Leave a Reply

1 comment

  1. WordPress doesn’t provide this function, you need to code this.

    /*
    
        This will be your home work:
    
        1. You need a page with a custom template
           + query var that returns the value of the custom field
           + custom loop that (you may use meta_query) finds posts
             with the same custom field value
    
        2. make function to convert the custom field
           to a custom permalink may be.
    
        http://example.tld/my_page/?custom_field=custom_field_value