Must Use Plugins – mu-plugins help
-
I am creating a php code to listen for a post from a webhook.
So I put it in mu-plugin since it will execute and never be overwritten when updates happen.
I have never created a plugin, so no idea how to do it with a plugin.
My question is, if it finds a post from the webhook, then does what I need it to, then have it print the header with 200 ok, then exit, why won’t the things that wp does work, such as:
wp_create_user( $_user_name, $random_password, $_user_name );
That code causes my site to get an error.
if I put the // in front, no error. if I let it do it, I do get an error.Also other things did not work, such as get_user_by did not work, but creating this function:
function get_user_by( $field, $value ) { $userdata = WP_User::get_data_by( $field, $value ); if ( ! $userdata ) { return false; } $user = new WP_User; $user->init( $userdata ); return $user; }
that does work… so how do I do this:
wp_create_user( $_user_name, $random_password, $_user_name );
if it does not work?
Is there a better way to create some code that would work, without using the mu-plugin?
Thanks,
-Richard
- The topic ‘Must Use Plugins – mu-plugins help’ is closed to new replies.