• Resolved rajpanchani

    (@rajpanchani)


    Hi there,

    My permastructure is : %brand%/%product%

    brand taxonomy is custom for the product.

    I am adding post by wp_insert_post.
    $post_id = wp_insert_post( $args );

    After insert, I run following.
    $value = “Rolex”;
    wp_set_object_terms( $post_id, array($value), $slug, true );

    Then file attached.
    But my permalink is not including Rolex in the product link.
    When I regenerate, it fix the brands.

    Is there any hook or code that need to be added after this?

Viewing 1 replies (of 1 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @rajpanchani,

    to generate the permalinks again you will need to directly access the global with the uris array:

    global $permalink_manager_uris;
    
    $permalink_manager_uris[$post_id] = Permalink_Manager_URI_Functions_Post::get_default_post_uri($post_id);
    update_option('permalink-manager-uris', $permalink_manager_uris);

    Best regards,
    Maciej

Viewing 1 replies (of 1 total)
  • The topic ‘Permalinks are not being set while using wp_insert_post’ is closed to new replies.