How to find out who handles a permalink?

My previous question isn’t faring too well. I guess it may be too specific. Let me approach the problem from another direction.

There’s an URL within my WordPress site. It’s occupied – sending the visitor to some resource.

How can I identify the type of resource is associated with this URL, and then find the actual resource – page, category, post, whatever else might be holding up that URL?

The link is not specific, no /tag/, /category/ or such on the path. It’s probably a custom permalink attached to some entity. I need to find that entity.

1 Answer
1

I am not sure I get the question correctly. Anyway, I will try. Correct me if I’m wrong.

What I understand your question is that you want to know which template is serving your URL. If that’s what you mean by resource, you should check out displaying current template path. It basically throw the template filename in head section.

add_action('wp_head', 'display_template');
function display_template() {
    global $template;
    $filename = basename($template);
    echo '<strong>'.$filename.'</strong>';
}

N.B: It should only be used for development purpose.

You can also determine the type of resource seeing the template.

Leave a Comment