How to persist data during the life of a page?
-
I may be missing something really basic.
My plugin will do database calls during filters that are earlier in the loop (‘modify_header_image_data’ & ‘wp_get_attachment_image_attributes’), and then repeat them during ‘wp_footer’.
I’d rather do everything once, store it in a variable, let wp_footer read it.
I’d expect there to be a per-page scope where users can create variables. But I don’t know what it is.
- The plugin.php file seems to be loaded once, at startup, and assigns hooks & filters that run per-post (or more often).
- The Post object doesn’t have a generic data field to put stuff on.
- The Object Cache has an expiration measured in seconds, and seems to be for stuff that persists *between* pages.
- The Transients API is even longer term, for pushing objects from memory into the database.
What really obvious thing am I missing here?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to persist data during the life of a page?’ is closed to new replies.