As @s_ha_dum says in his comment, your description and your code seems to be different.
If I understand the description, the code to do what you want is:
function __set_all_posts_for_author( $query ) {
if ( is_admin() && is_post_type_archive( array('listings', 'contacts', 'events') ) ) {
$current_user = wp_get_current_user();
$query->set( 'author', $current_user->ID );
}
}
add_action( 'pre_get_posts', '__set_all_posts_for_author' );
Using the code above, every time an user that is logged in the backend require items list of CPT ‘Listings’, ‘Contacts’ and ‘Events’ he/she will see only the post created by himself/herself.
Related Posts:
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Loading External Scripts in Admin but ONLY for a Specific Post Type?
- Customize Edit Post screen for Custom Post Types?
- Filter by custom field in custom post type on admin page
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- Merge two custom post types into one admin page?
- Remove the “View” Link in Post Admin
- Multiple custom post types under one admin menu
- How can I change the admin search posts fields?
- Custom post type: Add “Edit | Quick Edit | Trash | View” links to date (if title is not shown in column)?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Add “Last Edited by” column to custom post type list table
- How can I filter posts by post_parent in the admin?
- Custom post type admin search
- Ordering posts by custom taxonomy in admin area
- Create a dropdown with Custom Post Types as option in admin
- How to add custom columns to Custom Post Type admin screen
- How to Make an admin_notices Message That Disappears Once the User Leaves That Particular Page?
- Filter admin columns by custom post field value
- Is it OK to move admin menu items?
- Filter by custom Field for Custom post type Admin Listing
- Admin Post Update Redirection to Posts Screen
- Exclude add_filter from the admin
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- Custom Post type sort order not working in the admin area
- How to get search results in the backend admin on a custom post type?
- Add custom column to custom post type overview in backend
- Unable to filter on field on edit.php page
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- No results searching custom post type in admin panel
- How to add post_author column to custom post type
- Adding help information to custom post edit page
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Change admin post thumbnail size for custom post type only
- Filters post in admin with dropdown select, custom post type
- Admin List Dynamic Heading
- WordPress User Roles, Custom Post Types, and Admin views
- Settings page above CPT page in admin section
- How to search CPT’s by meta query from the admin dashboard?
- Add theme options to custom post type admin pages [closed]
- Using WPAlchemy metabox values in another metabox
- Add text to wordpress admin ‘Add Post’ edit
- Changing ‘view’ link for custom post type on list post screen?
- Sort admin area by custom Event Date field
- How can I change the title of an Add New page in Admin for custom post type
- How to customize admin posts based on the user who is logged in
- Set a default category – if the user didn’t select one- before creating a post
- Add html to cpt main page / admin edit.php
- How can I create a custom meta box to add an mp4 video to a page?
- Remove rows in the manage post/page view
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Access $post object when adding custom columns to list table
- Add acf field in title (admin table)
- Customize my custom taxonomy table in Admin panel
- Get parse_query filter to return slug instead of id
- Custom Post Type Nav to Subpage
- Selecting a post in Dashboard
- Custom admin post.php page
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Notify admin on new submit
- On update or create post redirect to current post position in list
- Admin Column does not populate with data
- Filtering posts list table
- CPT Validation to not show “Post updated.”
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Custom post type isn’t working
- Add a ‘guide’ image to custom post type admin page
- Use remove_meta_box conditionally on custom post type
- New “Custom Types” item in admin menu. Is this a plugin or a new wordpress feature?
- Sortable column containing numeric values for Custom Post Type at WordPress Backend
- How to check if post/page or taxonomy post is published by admin
- Linking to Post Types from wp-admin
- Plugin or method of allowing user to rearrange custom post types with drag and drop?
- CPT Columns doesn’t show categories
- Insert Custom Post Types
- sortable columns for multiple custom post types not working
- Showing User’s Post Counts by Custom Post Type in the Author.php?
- Add ‘page template’ column to dashboard for CPTs
- Filter posts of custom post type by meta key in (List All Section)
- Is there a hook between clicking on “Add new” and the edit screen of a new post?
- Require custom post type if is_admin() – template doesn’t show up?
- Function to add custom HTML into head in custom post-type list page
- using the loop in custom meta is messing up ‘add new’ post type
- WordPress admin for a custom post, hide/collapse the main “title” and “description” boxes
- Metaboxes inside Tab
- How to hide private posts even if user is admin
- Create an administation subpage containing posts in a certain category
- Custom post type doesn’t display on admin list
- Customising the admin columns for a custom post type, but now most of the built in categories don’t display?
- Shared Custom post type between WP network sites
- Exclude categories For Custom post types
- Redirect preview single post link to a page
- Custom Post Type Causing Admin Sidebar UI Issue
- How to change the default orderby from “Date” to e.g. “Title” or my custom column in content type records list in admin?
- Change column of row action (Quick Edit) links in WP_List_Table
- Collection of fields in a single post
- Prevent users from changing post status
- Display read only info on admin, custom post page
- Custom Plugin w/ Custom Post Types – Custom Posts Are Showing at all Privilege Levels – Is this possible to adjust?
- Admin menu link with variable