php - Include central function that applies for all my Wordpress themes -


I have a WordPress network that has a large number of different topics and even more pages using those topics.

Now, I have a PHP function (for some tracking) that I can access from my network to a page all the time. I do not want to edit all my topics, so I'm looking for a central file where I can get this new job.

The first thing in my mind was that index.php WP installation would probably work, but not the best solution.

All my topics are using the wp_head function, maybe it can help in any way?

Is there any other place where I have my tracking code and make sure that every page is running at reach?

You should create a plugin In that plugin you will have that function and add action to the wp_head hook, it will continue to work with all your subjects and can easily change without having to go through all its subjects.

Code will look like something

  / ** * Plugin name: Tracking function * Description: Allows me to track my code / / function tracking_function () {// enter code here} add_action ("wp_head", "tracking_function");  

Then, because you have a network of sites, you have to go to Network Plugin Manager, and all the networks have to activate the plugin and then you can activate it for each specific You can disable the site in your network.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -