How add any custom text as Suffix OR Prefix in post url: WordPress

Hello Friends! :)
If you want to add any text in Post URL (suffix/prefix) then just use my code

function save_url_suffix($post_id) {
global $meta_box;
// check autosave
return $post_id;
// check permissions
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
global $wpdb;
$myrows = $wpdb->get_results( "SELECT post_name from  wp_posts WHERE ID ='$post_id' AND post_status = 'publish'" );
    foreach ($myrows as $page) {
            //echo $page->post_name.'<br/>';
       $wpdb->query("UPDATE ".$wpdb->posts." SET post_name ='".$page->post_name."_".$post_id."'  WHERE ID ='".$post_id."'");
      //add_action( 'save_post', 'save_seo_meta_box' );

Enjoy Code! | Raghunath Blog :) :)

11 Replies to “How add any custom text as Suffix OR Prefix in post url: WordPress”

  1. Fenomenala ocena. Właśnie takiej informacji szukałem. Wyślę tę witrynę
    przyjaciołom. Przyrzekam że będę tu wracał. Szczęścia
    w dalszym tworzeniu.

  2. Hey I қnow this is off topic bսt I waѕ wondering if
    уοu knew of any widgets I could add tο my blog that automatically tweet mү nеwest twitter updates.
    I’ve been looking fоr a plug-іn likе this for quite sоme time aոd
    աas hoping maybe үou ѡould havе ѕome experience ԝith ѕomething like this.
    Plеase let me know if yoս ruո into anything. I tгuly enjoy reading
    ƴour blog and I look forward tо yoսr ոew updates.

  3. First off I want to say awesome blog! I had a quick question which I’d like to ask if you do not
    mind. I was interested to find out how you center yourself and clear your mind prior to writing.
    I’ve had trouble clearing my thoughts in getting
    my thoughts out. I do take pleasure in writing but it just seems like the first 10 to
    15 minutes are usually wasted just trying to figure out how
    to begin. Any ideas or tips? Thank you!

  4. Have you ever considered about including a little bit more than just your articles?
    I mean, what you say is valuable and everything. However think about if you added some great visuals or video clips to give your
    posts more, “pop”! Your content is excellent but with pics and videos,
    this site could definitely be one of the best in its field.
    Wonderful blog!

  5. Awesome site you have here but I was curious if you knew of any message boards
    that cover the same topics talked about in this
    article? I’d really love to be a part of community where I can get comments
    from other experienced people that share the same interest.
    If you have any suggestions, please let me know.

  6. Hello! I could have sworn I’ve been to your blog before but after
    looking at many of the articles I realized it’s new to me.
    Anyhow, I’m definitely pleased I discovered it
    and I’ll be bookmarking it and checking back often!

Leave a Reply

Your email address will not be published. Required fields are marked *