- This topic has 1 reply, 2 voices, and was last updated 8 months, 2 weeks ago by .
-
Topic
-
I have a CPT “Company.” It only uses custom fields, no title or content.
Due to no title, I need my frontend submission form to create it from a field. I’m using the following code snippet:
function iswp_update_company_title( $data ) { if($data['post_type'] == 'company' ) { // Check post type $title = $_POST['company-name']; $slug = sanitize_title_with_dashes ($title,'','save'); $slugsan = sanitize_title($slug); $data['post_title'] = $title ; //Updates the post title to your new title. $data['post_name'] = $slugsan; //Updates the post name aka slug to sanitized version of title. } return $data; // Returns the modified data. } add_filter( 'wp_insert_post_data' , 'iswp_update_company_title');
This works fine on the front end submission. If I go into the admin area to update a company, it also seems to work fine.
However, if I create a new Company from the admin area, the Publish button changes to Submit for Review and I see the warning “You are currently editing the page that shows your latest posts.”
What do I have wrong?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.