Posted: November 1, 2018 at 5:29 am
|
I would like the post slug of events to be generically generated from the post/event title + the first datetime. So far the slug is generated correctly. I am using the action hook: wp_unique_post_slug In the corresponding callback function I get the event and datetime and recreate the slug:
That works, as the slug is generated correctly. However, when I hit publish the event does not get published. It says it get published, but does not. What is wrong? How to solve that mystery? Thanks. |
Hi, I’m not quite sure if your code is going to do what you’re expecting it to do. For example, in this conditional:
You might also check to see if there are other plugins adding filters to wp_unique_post_slug as well, they may be interfering. |
|
|
Basically, what I am trying to achieve is the following: We have events that have the same title, e.g. “soccer” but on different datetimes and different venues. Although I can assign multiple datetimes to one event, there can only be one venue assigned to the event. Therefore, we have one event for each datetime + venue. In the example above we have three events, each with its own single datetime. Now the reason for the slug manipiluation. I want to avoid having event slugs like, soccer, soccer-1, soccer-2. But instead, I would like event slugs like soccer-datetime, e.g. soccer-2018-12-31-20-00. Therefore slugs are more accurate. I only have EE plugins and my own plugin running. |
So if you remove your custom code for changing the slugs, the event will publish as expected? |
|
|
yes, it will. |
The code you’ve shared here doesn’t prevent events from publishing on my site, so another thing you could check is to see if that code alone, with no other code from your own plugin running, prevents the events from publishing. It may also help to switch to the default WP theme while troubleshooting this. |
|
The support post ‘Replacing slug on espresso_event post type does not allow the post to be publish’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.