• Resolved ktiwari

    (@ktiwari)


    Hi @mbis,

    Recently after updating this plugin to 2.3.0, we are facing one issue where we are unable to get post ID by passing page url to function ‘url_to_postid‘. We are calling that function as follows:-
    $post_id = url_to_postid($url);

    It returns null response after update and it was working fine for older version. Please look into it and do let us know if we are doing anything wrong here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ktiwari

    (@ktiwari)

    Hi @mbis,

    Found one fix that after removing one condition that was added in 2.3.0 version in file ‘permalink-manager-uri-functions-post.php‘ in function ‘url_to_postid‘.

    public function url_to_postid( $url ) {

    global $pm_query;

    // Filter only defined URLs

    if ( empty( $url ) || ! is_array( $pm_query ) ) {

    return $url;

    }

    Removing the condition to check is_array made it work. This was added in latest update version 2.3.0. Is there any issue with that condition?

    Plugin Author Maciej Bis

    (@mbis)

    Hi @ktiwari,

    Thank you for your input, and please accept my apologies for the inconvenience.

    I changed this to make sure the $pm_query variable is defined.
    However, this was not needed, because even if $pm_query is null, the impacted function will execute normally.

    I restored the old state of the “if” condition and amended the last update:
    https://plugins.trac.www.ads-software.com/changeset/2835028

    Best regards,
    Maciej

    Thread Starter ktiwari

    (@ktiwari)

    Thank you for the quick fix @mbis .

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unable to get post ID from url after updating to 2.3.0’ is closed to new replies.