• Hello,

    I am wanting to find out a piece of code and where to place it. My idea is to have specific posts show on the front end side of my website. When a client logs in they arrive at their own profile, which there they can upload (post) images or videos. From this I then want to show what they have just posted as well as their previous content they have uploaded.

    I know it’s possible because anything is possible, but just how should I do it and how can I do it?

    I’m not the fastest of learner, but I appreciate any help given as this has been tormenting me for weeks.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You could use the “pre_get_posts” action to restrict posts queried to only the ones the current user has authored. Such code could be placed on functions.php of a child theme or within a simple site specific plugin you create. Creating a child theme or plugin is not as ominous as it may sound. They are essential to protecting your work from being overwritten by updates. You can learn more about these in the Codex.

    You would further manage post visibility in the pre_get_posts callback with various conditionals. For example, if the current user’s role is administrator, don’t restrict posts.

Viewing 1 replies (of 1 total)

The topic ‘Specific posts for Logged in Users.’ is closed to new replies.