I am working on a legacy code where part of the website uses WP and other part ASP.net etc. Is there an easy way to tell me what content is coming from WP vs Non-WordPress? Since the codebase is large this can help me understand the flow of information.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
This depends very much on you setup and how you want to be able to see this.
If you look in the source code of a page, you are very likely to be able to see which page is WP generated, because there will be strings like wp-content and wp-includes present (for instance because jquery is loaded by default). You could also add a specific code to the head of your site like this:
add_action ('wp_head','wpse376765_add_code');
function wpse376765_add_code () {
echo '<meta name="wpmademe">';
}
If you want it to be visible in the page itself, the easiest way would be to attach a little marker for admins only by including this in the functions.php of your theme:
add_action ('wp_footer','wpse376765_add_code_to_footer');
function wpse376765_add_code_to_footer () {
if (is_admin()) echo '<span>WP made me</span>';
}
Method 2
WordPress outputs a generator meta tag using the the_generator() function, that you can use to identify it.
For example, WordPress.com sites have this:
<meta name="generator" content="WordPress.com" />
https://www.metatags.org/all-meta-tags-overview/meta-name-generator/
Note that some themes/plugins remove this tag as it has no practical use for most developers and no SEO benefit
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0