to restrict on the back-end you can use the default author role.
and on the front-end you ca use something like:
function check_rights_8876(){
global $post,$current_user;
$author_id=$post->post_author;
get_currentuserinfo();
if ( is_user_logged_in() ) {
if ( current_user_can('manage_options') ){// admin
return true;
}
if ($author_id = $current_user->ID ){// curent post author
return true;
}
}
return false;
}
Once you have this function defined you can check before displaying the post like this:
if (check_rights_8876()){
//display the post
}
else{
//Sorry but you don't have rights to access this post massage here
}
Hope this helps
Related Posts:
- How to remove admin menu pages inserted by plugins?
- Making Custom Fields Standard in the Admin UI
- Custom ReCaptcha Login
- Creating my own Admin Forms in a WordPress CMS?
- How to make custom bulk actions work on the media/upload page?
- Removing fields from the Media Uploader/Gallery
- deleted users still show in count?
- How to build custom WP admin with custom URLs
- Redirect members to custom page upon logging in through WP admin
- Custom Dashboard Home Screen Options
- Add a page that appears in the backend admin that lists files to download? WP 3.3
- Adding “Interesting Tags” & “Ignored Tags” like StackOverflow.com in a WordPress Blog?
- How do I change the default admin color scheme in MP6
- Extend Screen Options
- Admin Panel – Custom Menu Sub-Item LINK
- Adding custom styles to dropdown in editor
- how to add custom css and js on wordpress post editor directly without using .php file
- How to customize core admin pages within a theme?
- Allow non-admins to access the Customize theme page
- How to change popular term checklist title when edit post?
- WordPress customizer Preview not loading
- How to use default WP form elements to interact with custom DB table?
- Extend WordPress Core Classes in OOP Theme?
- Customizing Users in Admin Area
- Custom Columns WordPress Admin
- add custom content to appearance/widgets screen
- theme customizer – can a single option pass multiple values?
- How to remove admin menu pages inserted by plugins and themes in the top admin bar?
- Customizing admin look and feel for just one particular type of user
- Open login logo URL in new tab
- Change admin_title of a plugin using code snippet/functions
- Delete a column in edit.php generated with a plugin
- Add admin page for specific post status (for example)
- How to show Term ID beside Name Category with wp_dropdown_categories()
- How to create custom backend admin menu in different languages?
- POST 429 Error when trying to place more than 20 images into post at once
- Figuring out how to create “Option Pages” in WordPress admin
- Check get_post value after wp-admin login
- Custom Admin Section
- where can i find the login page in wordpress and add my header to it
- Style Radio Buttons inside Edit Page (Custom Fields)
- Changing a setting in the wp-admin/customize.php reverts CSS styles to parent theme [closed]
- Create Custom Admin Fields
- How to create functions that affect only a specific user
- Prevent posts from being published if the ‘Uncategorized’-category or no category is selected
- Import bootstrap 5 and bootstrap icons in wp-admin backend
- How to benchmark a WordPress installation? [closed]
- Modify existing plugin function using filter (without modifying the plugin directly)
- get_pages() not ordering as it should
- Get all products with a custom attribute
- Why do folders have Empty Index.php Pages?
- Is it possible to use Gutenberg on the front-end?
- How to get shortcode working from custom meta field
- How to search in a Custom Field?
- Does WordPress not use relative URLs?
- Add more rows on media picker
- How to override wp-login.php
- Remove Links from Login page
- create custom page for statistical data capture and reporting
- get_terms return errors
- media_handle_upload weird thing
- Get the post attached to a image attachment
- Customise search form in the Widget
- How to get value from custom backend menu
- Comment filtering (search)
- Removing label ‘WordPress’ from the title bar
- Schedule cron event from widget
- WordPress Network Feature
- Use WordPress file upload in my plugin – on frontend and on backend?
- Custom column under All Users (multisite network admin)?
- Gutenberg: How to mix dynamic and static output?
- add_rewrite_rule won’t work
- Comments Confusion
- Last time a user logged in
- Setting up Different Layouts for Each Product Category and Subcategory [closed]
- Prevent access to custom login page for logged in users
- Remove template drop down for certain pages
- Adding all sub-pages to the menu manager
- Hide devices selection from customizer?
- Add options to the “Screen Options” section on the “Menus” editor
- Split Conference WordPress Page in different years
- Make custom user table column filterable
- How I display post of the post type group by year of post?
- How to update preview when custom setting changed in my custom widget
- Hide editor with specific post meta value
- Side by side blogging?
- how to get the categories for a single product in a hierarchical way
- large chunks of text went missing
- Add a date updated/date modified option using custom fields
- Extra theme – header customization help [closed]
- Disable widgets in customizer for sidebar
- How do I change .css versioning?
- Save & Publish disabled for two dimensional array Customizer
- Deep customization of wp-login.php
- Background image no more visible in the preview
- A Voting system for a pageants
- Looking for a way to align log in form fields with background image and scale responsively
- Customizing Additional CSS editor
- How To Fix the “Another Update is Currently in Progress” Error in WordPress
- Newbie question – which css file to edit