I've done my requisite research and can't seem to find an ELEGANT way to do this.
We have a Wordpress app with some fairly intensive session management requirements and now need to run some old code before even loading Wordpress. I plan on initiating this process on the first line of the WP index.php file.
However, depending on the results of this old code, we may need to pass along a handful of key/value data from this process down to the plugin level in WP. What would be a good way to approach this? Thanks!
UPDATE (2017-01-19):
I just decided to use a local Redis instance to store any k/v data should the request need to proceed onward and load WP.
I've done my requisite research and can't seem to find an ELEGANT way to do this.
We have a Wordpress app with some fairly intensive session management requirements and now need to run some old code before even loading Wordpress. I plan on initiating this process on the first line of the WP index.php file.
However, depending on the results of this old code, we may need to pass along a handful of key/value data from this process down to the plugin level in WP. What would be a good way to approach this? Thanks!
UPDATE (2017-01-19):
I just decided to use a local Redis instance to store any k/v data should the request need to proceed onward and load WP.
Unless performance is a huge factor, or you need to change PHP session globals, you don't need to run anything before wordpress, just write a plugin that makes the checks needed on the init
hook and die()
if needed. This way you can also store the data wherever it is convenient for you.
For sure editing any wordpess core file is a big no-no which amount to forking wordpress with all the responsibilities it requires from you. The only file you may edit is wp-config.php
but this should probably be done only if the plugin approach will not work
https://codex.wordpress.org/Plugin_API/Action_Reference
Take a look at this list of hooks and call your function using the hook that you think is appropriate for your need.