front end submission for post type does not auto refresh permalinks
Support › MB Frontend Submission › front end submission for post type does not auto refresh permalinks
- This topic has 8 replies, 2 voices, and was last updated 1 year ago by
Nicholas Cox.
-
AuthorPosts
-
February 22, 2024 at 4:40 AM #44646
Nicholas Cox
ParticipantHi
I setup a custom table with a custom post type and front end submission form. There are no issues with the form. But I noticed when there is 0 posts and you create the first ever post using the front end form, the posts single page returns a 404 message, even though the post is in the database. If I manually force the refresh of permalinks in wordpress it fixes the issue. Is this normal behaviour?
thanks
February 22, 2024 at 8:43 PM #44649Peter
ModeratorHello Nick,
It could be a caching issue on your site. I don't see that on my demo site. After creating the first post in the frontend, it is accessed properly.
March 7, 2024 at 12:22 AM #44763Nicholas Cox
ParticipantHi
I dont have any caching enabled on my localhost machine, I have submitted the post using the ajax form and it links to a custom table. Not that it should affect this. I have re-tested quite a few times and it only does it when there is no existing posts in the database (so the first post using the front end form).
I will keep looking to see if i can find out any more information.
March 10, 2024 at 8:12 PM #44784Nicholas Cox
Participanthere is the metabox code I'm using to create the posts for a custom post type of 'product'. Is it an issue with custom post types and tables?
$meta_boxes[] = [ 'title' => 'Products', 'post_types' => 'Product', 'storage_type' => 'custom_table', 'table' => $wpdb->prefix . 'dc_products', 'id' => 'dc-product', 'context' => 'normal', 'fields' => [ [ 'type' => 'text', 'name' => 'Title', 'id' => 'post_title', 'class' => 'dc-post-title', 'limit' => 50, //default character length 'required' => true, ], [ 'type' => 'textarea', 'name' => 'Description', 'id' => 'description', 'required' => true, ], [ 'type' => 'number', 'name' => 'Price', 'id' => 'price', 'step' => '.01', //two decimal places e.g. 0.00 'placeholder' => '0.00', 'required' => true, ], [ 'type' => 'number', 'name' => 'Sale Price', 'id' => 'sale_price', 'step' => '.01', //two decimal places e.g. 0.00 'placeholder' => '0.00', 'required' => false, ], [ 'type' => 'select', 'name' => 'Condition', 'id' => 'condition_id', 'options' => (new DripCreateProductCondition())->conditionTypes, 'multiple' => false, 'placeholder' => "", 'select_all_none' => false, 'required' => true, ], [ 'type' => 'text', 'name' => 'SKU', 'id' => 'sku', 'limit' => 10, 'required' => false, ], ], ];
March 23, 2024 at 6:58 PM #44974Nicholas Cox
Participanthi
any update on this? thanks
March 30, 2024 at 11:15 AM #45068Peter
ModeratorHello Nick,
I make a test on my local site with your fields but don't see that issue, here is the screen record https://drive.google.com/file/d/1qXIh26Qf6S60XcZcUbVLUocVtPllBai7/view?usp=sharing
I also notice the setting
'post_types' => 'Product',
the post slug should be in lowercaseproduct
. Please correct the slug and try this again on a clean installation then see how it goes.March 31, 2024 at 5:49 PM #45078Nicholas Cox
ParticipantHi
Yes i have tried a new installation with the lowercase 'product' post type as the same issue persists. When i manually clear the permalink cache it works, if i dont i see a 404 page if i try to visit the custom post type single page. I found a old post https://support.metabox.io/topic/permalink-issue-with-custom-post-type/ which said that using
/%postname%/
permalink structure had issues (which is what im using) but is not clear on what the solution was at the time. If I use the 'plain' permalink wordpress structure there is no problem when replicating the above.any ideas? As the problem seems very intermittent and i have tried over 10 times and only one of those times of replicating that the
/%postname%/
permalink structure worked without manually refreshing permalinks.thanks
April 1, 2024 at 8:30 PM #45090Peter
ModeratorCan you please share your site credentials by submitting this contact form https://metabox.io/contact/ ?
I will take a look.
April 9, 2024 at 11:04 PM #45184Nicholas Cox
ParticipantHi Peter,
I cannot as im working on a local development project and is not available online.
Its a difficult one to alway replicate, must be something to do with WordPress. I have no cache enabled. I will try and get a video of the issue but the post appears in the database ok, just the 404 when viewing the permalink for the page
Nick
-
AuthorPosts
- You must be logged in to reply to this topic.