WordPress – Replace function – Multisite

A few plugins I want to use don’t support WordPress multisite as they store data in wp_usermeta tables and these could vary by site.

An option is to replace each instance of

add_user_meta( int $user_id, string $meta_key, mixed $meta_value, bool $unique = true ) or update_user_meta() or get_user_meta()

with

update_user_option( int $user_id, string $option_name, mixed $newvalue, bool $is_global = false ) or get_user_option()

I could change the plugin code and replace this, however it’s not a manitainable solution as it needs to be done with every plugin update. Also, the add/update/get_user_meta is called in a variety of places within each of the plugins.

Is there a better way to do this with a custom function or an mu_plugin?

  • You could also try reaching out to the developers of the aforementioned plugins and see if they would be interested in providing Multisite support. Or consider using plugins that do support WP Multisite out of the box instead.

    – 

Leave a Comment