• Hello everyone,

    I want to let two WordPress plugins work together, so I can use a variable of the first plugin in the second plugin.

    Does anyone know how to do that?

    Greets,
    Joren

Viewing 1 replies (of 1 total)
  • There’s many ways of doing that. I guess it would depend on how your plugins are set up.

    The ways that I can think of off the top of my head are:

    • Set up the value as a global variable and access it using global $my_var_name; where it’s needed.
    • Add it as a public value of a class or object, and you could use either MyClassName::$my_var_name or $object->my_var_name to get it.
    • If it needs to be stored for longer than just a isngle page load, store it in the database using update_option() and get it using get_option().

    There’s probably more, but that’s a basic overview.

Viewing 1 replies (of 1 total)
  • The topic ‘2 WordPress plugin work together’ is closed to new replies.