From the code it seems like your warning comes from doing the redirect too late. redirects should be done, as a rule of thumb, not later then the init action. And after the redirect you should die() (I don’t think the wp_redirect
does it for you)
As for security, it is not enough to check that the user is logged-in, you need to check if he has the capability to edit the post, something like if current_user_can('edit_post',$post_id)
. You need to check it both on the UI side and server side. just because you do not show the ability to the hacker doesn’t mean he will not construct a special HTTP request to change the post if you don’t have protection on the server side.
Related Posts:
- Developing a secure front end posting form
- Front-End Post Submission
- How to upload post thumbnail while wp_insert_post?
- Publish pending article from front end with a button?
- Get names of authors who have edited a post
- Edit a post from frontend. post_tags get saved, but not separated
- How can I edit a post from the frontend?
- Post from front-end only by logged in users, form posts as “posted by:
- upload featured image from front end using wordpress add media button
- Post & edit a post from front end along with upload, dropdown, and other inputs
- Disable REST API for a user ROLE
- Embed WordPress Admin in an iframe
- Frontend Post Excerpt field mapping
- Frontend Post Form Validation
- The ‘https_local_ssl_verify’ filter
- Redirection not working in this front end post submission form?
- How to change the color theme per post?
- Adding an image to a non existing post
- How to make a bilingual front-end post using the plugin WP User Frontend and Polylang or qTranslate?
- Change Post Status From Front End
- 404 error on default post type and default taxonomy fronted page
- Security to delete post by Admin
- Lock post editing to one user at a time – wp_check_post_lock
- Front end post submission form with duplicate type fields
- Replace image name on upload to the new post name on front-end form
- Edit the post title from the frontend
- Can i have more than one form for front end posting in one template [closed]
- Get Users Post ID
- How do I allow certain users to make a certain type of post?
- WordPress wp_editor to post and edit
- Allowing Users to Register Themselves and Post : Does WordPerss Handle these Problems?
- How to limit post (Exception pages) for current user in each role in front end?
- Create posts by any logged in users
- How to generate an HTML link automatically from URL in a users’ post
- how let users select categories for posts in frontend?
- Allow reader to reorder posts for themselves (oldest first)
- Send the post id to a front end edit post form
- Post/Edit/Delete Post From Frontend… How?
- Send/Publish a Post front end
- How Can I Limit Users to Post Creation For My Frontend Theme?
- User driven content problems
- Create post from form with image
- Stop Authors from submitting spam post
- Show post count in custom taxonomy page
- Top tags with minimum number of posts
- Set a post expiration and delete a post when expirate
- Parent menu item does not display posts when I add the sub-items
- How to 301 redirect from url with post id to permalink with post name (slug)?
- Count singular post views automatically
- Create/Set Category as Title of Post
- Reusing old post IDs
- Taxonomy checkboxes not showing current status on edit page
- Add a url parameter to the current post and read it in a shortcode
- Posts not showing content after migration
- Blocked posts in network tab
- How to distinguish pages created by woocommerce?
- Trigger on DB make problem on wordpress?
- Post images are not displayed in media library
- How to show WP admin edit page within template page/post?
- WordPress Screen Options, Help, Visual editor, Status, Visibility, Revisions, Published on and any toggled indicator don’t work for posts
- Centre Blog Index (Posts Page) on Home.php
- How to prevent post update using transition_post_status
- Dropdown Select Post Filter
- Blogposting Schema & Structured Data without plugin
- Order posts inside bootstrap card columns
- Save ACF with a save button on a post
- Delete attached images from posts
- Unable to edit or post after enabling SSL
- Exclude posts in a category on one page but show those posts on a different page
- Single post shows post three times
- What permissions does a role need for the user to be assigned as the author of a post?
- How publish post from pending status
- Hide or remove custom post status
- Template for displaying CPT / Taxonomy URL issues
- Countrywise Post View
- Multiple posts in one page
- post__in no longer works in wordpress 5.0.3
- Scrollbar disappear in post window
- long-title posts do not want published
- call to jquery ajax failing with 500 error when passing extra data field
- How to count posts in tags within time limit
- Automatically select template based on query string for New Posts
- How to create a button to filter posts (list) by meta value
- WordPress MySQL Search and replace with wildcard?
- Put page on Archived statut after end of publication date
- Moved a website and excerpts don’t work for old posts
- How to remove a post from results by ID after query?
- get_next_post() not working with future post status
- Why do I have categories with duplicate slugs?
- Blog featured images disappeared on my homepage
- Posting or Updating Article Fails on WordPress [closed]
- Blog images not showing on homepage
- How to display related post from same category in single.php
- Using a meta_value or postdate to to query and orderby
- Exclude posts in home slider from sections
- WordPress weird behaviour on comments
- post thumbnails error
- WordPress the_category(); only works with message-posts not with project posts, how do I specify project categories?
- Display images of related posts
- Display Updated Date Instead of Published Date