This is more of a conceptual question, but it has actual ramifications.
Going through the various SEO plugins I found nowhere a PHP tag that should be embedded in the actual HTML page and echo the meta data. How does it work then?
Simply saving it to the DB doesn’t seem enough. What is the mechanism through which the plugin “injects” the SEO data to the page? and what if I have my own meta tag in the page – Would it override the plugin?
The mechanisms are usually FILTERS and ACTIONS hooks from the wordpress Plugin API
This is not particular to the SEO plugins, but to almost all the plugins that change actual content .
simply put :
Actions Hooks are designs to be used when WordPress core itself, some plugin or theme is giving you a special “breakpoint” to insert your code in order to do some action, or change something while a certain action is triggered .
Filter Hooks are very similar to Action Hooks but what they do is to receive a value and potentially return a modified version of that value.
UPDATE I
see this simple example (put in your theme´s function.php
or this :
UPDATE II
IF however, your question is actually about how SEO works, and not the plugin itself :
SEO is a big subject, but simply put , it is about the meta-tags, titles, descriptions, links, rels etc … this is what the SEO plugins are changing .
They change things like –
.. – but they all use the above mentioned mechanism of
actionsandfiltershooks. the fact that you do not see it in the code, is that you do not know what to look for .Try to save the page source BEFORE and AFTER the plugin activation, and then do a diff on both. You will see the differences …