Forum Replies Created
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
ccarey75ParticipantYou want the save_post hook
https://codex.wordpress.org/Plugin_API/Action_Reference/save_postadd_action( 'save_post', 'my_save_post', 11, 2 ); function my_save_post($post_id, $post){ //if it is just a revision don't worry about it if (wp_is_post_revision($post_id)) return false; //if the post is an auto-draft we don't want to do anything either if($post->post_status != 'auto-draft' ){ // unhook this function so it doesn't loop infinitely remove_action('save_post', 'my_save_post' ); //this is where it happens -- update the post and change the post_name/slug to whatever you want wp_update_post(array('ID' => $post_id, 'post_name' => YOUR_SLUG_HERE ); //re-hook this function add_action('save_post', 'my_save_post' ); } }
ccarey75ParticipantI spotted this from back in 2016 — it sounds like the intention is/was to keep it in active development but it would be very reassuring to see some sign of life!
ccarey75ParticipantI’ve only started playing with it so there may be other ways, but you can create a grouped field and repeat that, which is much the same as the way ACF does things
piklist('field', array( 'type' => 'group' ,'label' => 'Event' ,'add_more' => true ,'fields' => array( // add the fields that describe an event array( 'type' => 'text' ,'field' => 'event_name' ,'label' => 'Event Name' ) // ... etc - more fields ) ));
ccarey75Participantthird that 🙂 (sorry just replying because I couldn’t see how to subscribe to the thread without doing so)
ccarey75ParticipantSorry to resurrect on an old thread from 2013 but was this ever implemented? The docs are missing for this field. I had a look through the demo code and couldn’t see mention of it.
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)