WordPress.org

Ready to get started?Download WordPress

Forums

User query posts by tag (2 posts)

  1. djfost
    Member
    Posted 1 year ago #

    Hi all. I am looking for a bit of advice in where to start with setting up a WP site so that the user can view posts by tag. I want a user to be able to type in their favourite tags e.g. music, cinema, then WordPress will return posts with that category. I know I can run a wp query but how do I involve the user in choosing which tags?

    Ideally I want those tag choices stored in a cookie/on their profile so they can return and get a personalised blog made up of their favourite tags, authors etc.

    Any advice would be great!

  2. Ben Casey
    Member
    Posted 1 year ago #

    in a normal WP site with permalinkls enabled, the user should be able to navigate to /tag/sometag and get the tag archive they are looking for.

    If you setup a form for the user to enter,

    hooked into init, check for submission

    run something like this:

    if( term_exists( $submitted_string, 'post_tag' ) ){
        /*Perhaps redirect here to the /tag/tag-slug URL */
    } else {
        /*Set a variable or a session to be able to notify the user that tag doesn't exist*/
     }

Topic Closed

This topic has been closed to new replies.

About this Topic