• Resolved apopov

    (@apopov)


    Hello, I have a need to retrieve redirections metadata from SEOPress plugin by REST API. I can successfully get it with wp-json/seopress/v1/posts/:id endpoint, passing redirection post id as path parameter. But when I try to use /wp-json/seopress/v1/posts/by-url?url=[URL] endpoint, passing there URL with redirection slug, I receive 500 error in response. (e.g. https://example.com/wp-json/seopress/v1/posts/by-url?url=https://example.com/live-demo-apple-watch)

    I did some debugging, and this is happening due to plugin being unable to specify post-id by url at:
    …/wp-content/plugins/wp-seopress/src/Actions/Api/GetPost.php:110

    in processGetByUrl function, at this line i receive 0 as $id:

    $id = apply_filters('seopress_headless_url_to_postid', url_to_postid($url), $request);

    Then for some reason, returned error results in 500 error (but that’s another question):

    if(!$id){
        return new \WP_Error("not_found", "ID for URL not found");
    }

    Can you please help me with that?

    WordPress Version: 6.2

    SEOPress Version 6.5.0.3

    SEOPress PRO Version 6.5

    PHP version 8.2.5 (Supports 64bit values)

    • This topic was modified 3 years, 1 month ago by apopov.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SEOPress GetPost API’ is closed to new replies.