Support » Plugin: Permalink Manager Lite » get_permalink() returning old uri

  • Resolved regijorge

    (@regijorge)


    I’m trying to get the permalink of a post in a loop (wp query), but when using get_permalink() it does not return URI configured by the Plugin.

    Is there some function wich i can use to get the correct permalink?

    Thanks 🙂

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

    (@mbis)

    Hi @regijorge,

    could you post the full loop code, so I can reproduce this issue on my server?

    Best regards,
    Maciej

    amityweb

    (@amityweb)

    I also have this issue. get_permalink() just returns the domain.com/slug of the product, not its full path/permalink, here is my code:

    ` $productsForSitemap = get_posts( array(
    ‘numberposts’ => -1,
    ‘orderby’ => ‘modified’,
    ‘post_type’ => array( ‘product’ ),
    ‘order’ => ‘DESC’
    ) );

    foreach( $productsForSitemap as $product )
    {
    setup_postdata($product);
    $postdate = explode( ” “, $product->post_modified );
    $sitemap .= “\t” . ‘<url>’ . “\n” .

    “\t\t” . ‘<loc>’ . get_permalink( $product->ID ) . ‘</loc>’ .
    “\n\t\t” . ‘<lastmod>’ . $postdate[0] . ‘T’ . $postdate[1] . $tempo . ‘</lastmod>’ .
    “\n\t\t” . ‘<changefreq>Weekly</changefreq>’ .
    “\n\t\t” . ‘<priority>0.5</priority>’ .
    “\n\t” . ‘</url>’ . “\n”;
    }`

    Plugin Author Maciej Bis

    (@mbis)

    Hi @amityweb,

    please make sure that your code is executed after Permalink Manager URL filters.

    The filters are called after ‘plugins_loaded’ hook:
    https://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request

    Best regards,
    Maciej

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