WordPress Custom Hook with Class method

You can use an anonymous function with PHP’s use statement like so: function mycars($mycarsclass){ $args = array( ‘car1’ => ‘Volvo’, ‘car2’ => ‘Toyota’ ); $mycarsclass->add_node($args); } add_action(‘mycarsaction’, function () use ($mycarsclass) { mycars($mycarsclass); }); do_action(‘mycarsaction’); or declare a separate function and pass that: function mycars($mycarsclass){ $args = array( ‘car1’ => ‘Volvo’, ‘car2’ => ‘Toyota’ ); … Read more

WP_CONTENT_DIR disables plugin directory

@tom-j-nowell Thanks for your reply… Late last, night I finally cracked the problem using this solution, which I advise everyone to add to their dev notes if you have to migrate wp sites: solution: define(‘WP_CONTENT_DIR’, ABSPATH . ‘wp-content/’ ); define( ‘WP_PLUGIN_DIR’, WP_CONTENT_DIR . ‘/plugins’ ); In my case, I migrated a multisite from a LAMP … Read more