Custom post types – Use post_id in permalink structure

@Bainternet – your answer didn’t fully work but I did some more searching and was able to piece this filter together that did work:

add_filter('post_type_link', 'custom_event_permalink', 1, 3);
function custom_event_permalink($post_link, $id = 0, $leavename) {
    if ( strpos('%event_id%', $post_link) === 'FALSE' ) {
        return $post_link;
    }
    $post = &get_post($id);
    if ( is_wp_error($post) || $post->post_type != 'events' ) {
        return $post_link;
    }
    return str_replace('%event_id%', $post->ID, $post_link);
}

+1 for getting me most of the way

Leave a Comment

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş