• Resolved coadr93

    (@coadr93)


    Hello. Great plugin!

    I’m trying to get the expiration date for a custom post type to be a date from a custom field added with PODS when you create / save the post.

    I’ve tried modifying a similar code found online but it doesn’t seem to work…

    add_action('save_post_tabara', 'set_expiration', 20);
    
    function set_expiration( $post_id ) {
    
        $expiration = new DateTime(get_post_meta($post_id, 'data_incepere')[0]);
    
    	update_metadata( 'post', $post_id, '_expiration-date', strtotime( date_format( $expiration, 'Y-m-d' ) ));
    }

    I’m also trying to set a default category to be added from a custom taxonomy. In the settings there’s only an option for default categories on normal Posts but not on custom post types.

    Can you help me please?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default Expiration Custom Field’ is closed to new replies.