This members-only tutorial provides the steps to show only the entries written by the currently logged in user of a Custom Post Type on the CPT archive.

We shall set up an archive Template in Oxygen for entries of a workout CPT, create two Sections - one for logged-in users and another for visitors. The first Section for logged-in users will contain an Easy Posts component with the default query and the other Section for non-logged-in visitors will simply show a message that the user should be logged in to see the content of the page.

Then we shall use pre_get_posts to filter the posts by the author whose ID matches that of the logged-in user.

Step 1

If you have not already, register your CPT using a plugin like CPT UI.

Set "Has Archive" to True and type your desired slug for the CPT archive page. In this case: workouts.

In the "Supports" setting, tick "Author".

Add your CPT entries and ensure there are multiple posts authored by different users.

Step 2

Create a Template that applies to your CPT archive.

Edit it with Oxygen.

Add a Section.

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $399 one-time).

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?



You need to be logged in to view and post comments.
Not a member yet? Join here.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: