Given a WordPress permalink (or slug), is there a way to track backwards to figure out the code that generates the displayed page? For example, using this URL “my.domain.com/product-category/lamps/” or “my.domain.com/product-category/tables/” can you track the code used to make up the page that is displayed in the browser?
Basically, here is my problem. I’ve been hired to complete/fix a WordPress site that was heavily, heavily modified by the original programmer (who quit and is not available to help). The site uses the Stylo Theme with WooCommerce. The code to build the product catalog pages has been modified and I’m having a hard time finding all the PHP functions that do these modifications. There are no pages in the control panel that have a permalink that corresponds to the URL (shown above); so I don’t even know what template he has used to start these pages. He did not write a widget or plugin to make these changes, but changed the original code. His modifications broke (or deliberately disabled) some of the search functionality (min and max price range) built into the theme.
So, back to my question – given the final permalink displayed in the browser’s address bar, can I backtrack the code ‘path’ used to build the page?
This is an easy way to get the path of the template file that is used to render the current request. Place the code in functions.php in your theme or in a plugin and this will print the path on top of your site.
In my experience in similar circumstances, the easiest way to proceed is this:
1. Log in to the site. Make sure you have the wordpress admin bar enabled.
2. View the page in question from the front end.
3. Select ‘edit post’ or ‘edit page’ or whatever is offered
The link you supplied is likely to be for a woocommerce product category. Customization was probably performed either using templates (look for a woocommerce folder in your theme) or by utilizing hooks to add custom functions (look in functions.php).