Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Check if a URL is live for conditional statement

  • This topic is empty.
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)
  • The forum ‘Back End’ is closed to new topics and replies.