Support » Plugin: Permalink Manager Lite » Permalinks are not being set while using wp_insert_post

  • Resolved 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


    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,

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.