Forums

Auto Generate Post Slug (1 post)

  1. letusrise
    Member
    Posted 1 year ago #

    Good day!

    function rm_martins_cpt_permalink_change($data, $postarr) {

    if ($data['post_type'] == 'video') {

    $time = time();
    $data['post_name'] = md5($time);
    return $data;
    } else {
    return $data;
    }
    }
    add_filter('wp_insert_post_data','rm_martins_cpt_permalink_change',10,2);

    I found this code online. It's working but every time I update my post, post slug keeps changing. I would like this function to only run if post is to be publish only.

    Thanks and God Bless!

    [No bumping, thank you.]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.