Skip to main content

Forums

This topic contains 3 replies, has 0 voices, and was last updated by  slb535 6 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40730

    slb535
    Member

    Is there a way to check to see if a link goes to a valid page?

    I have code that I only want displayed if the link that is surrounding it is valid.

    I am in WordPress, if that matters. And I thought is_wp_error() might be the way to go, but it’s not working.

    Hope I’m explaining this well enough. Here’s my code:

    $practice_rep_link = “$practice_link-rep/”;
    if (!is_wp_error($practice_rep_link)) {
    echo ‘


    Representative Cases’.’

    ‘;
    }

    #113949

    chrisburton
    Participant
    #113971

    slb535
    Member

    Yeah, I’d tried that previously. It doesn’t seem to work for me. It tells me a page exists when it definitely doesn’t. Could it be because I have a custom 404 page?

    #113975

    chrisburton
    Participant

    @slb535 Possibly.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star