Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: Permalink with custom post_name #7835
    ccarey75
    Participant

    You want the save_post hook
    https://codex.wordpress.org/Plugin_API/Action_Reference/save_post

    add_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' );
       }
    }
    in reply to: Piklist next version ETA and changes? #7822
    ccarey75
    Participant

    I 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!

    Is it true that Piklist is dead?

    in reply to: Repeating metaboxes with add more #7806
    ccarey75
    Participant

    I’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
        )
      ));
    
    in reply to: Piklist next version ETA and changes? #7805
    ccarey75
    Participant

    third that 🙂 (sorry just replying because I couldn’t see how to subscribe to the thread without doing so)

    in reply to: Two way connections with post-relate? #7793
    ccarey75
    Participant

    Sorry 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.

Viewing 5 posts - 1 through 5 (of 5 total)