WordPress.org

Support

Support » How-To and Troubleshooting » User query posts by tag

User query posts by tag

  • 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!

Viewing 1 replies (of 1 total)
  • 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*/
     }

Viewing 1 replies (of 1 total)
  • The topic ‘User query posts by tag’ is closed to new replies.
Skip to toolbar