• Resolved earphanb

    (@earphanb)


    What is the best way to create custom code for wp_cache_add and wp_cache_set method to prevent to be deleted after update?

Viewing 4 replies - 1 through 4 (of 4 total)
  • @earphanb, are you looking for a hook/action that doesn’t exist?

    Thread Starter earphanb

    (@earphanb)

    object-cache.php is symlink (dropin) on script with same name in plugin directory, but I need to attach some prefix on keys in cache record and I change dropin script in wp-config directory to do that. After plugin update my code is overwrited because of symlink.

    What is a proper way to do this and change original functionality of wp_cache_set and wp_cache_add methods?

    Instead of symlinking, you can copy the source file to wp-content/object-cache.php and then make your changes— any future plugin updates would not overwrite the object-cache.php file outside of the plugin directory.

    I don’t expect object-cache.php to change too often (it most recently did to fix PHP 8.2 compatibility), but you will want to keep an eye on future releases changing object-cache.php which would no longer be applied.

    If you have a sense of how you might achieve your changes to object-cache.php using hooks/actions, you might also fork the plugin and open a PR to https://github.com/pantheon-systems/wp-redis/

    Plugin Contributor John Spellman

    (@jspellman)

    Closing this issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Create custom methods’ is closed to new replies.