General questions re: WordPress and WP plugins [closed]

You’re asking if you can build a website without any experience. The answer is yes, maybe. Could you build an airplane without experience? Yes, maybe. Why though? would it be safe and work correctly? Who knows? Spend time on things you’re good at and hire someone who is good at developing websites. You’ll spend less … Read more

How do I get the user ID of the user that was updated in WordPress?

You’re looking for profile_update & user_register. user_register is called after a user is created. add_action( ‘user_register’, ‘myplugin_registration_save’, 10, 1 ); function myplugin_registration_save( $user_id ) { // Do stuff with $user_id } profile_update is called after a user is updated. add_action( ‘profile_update’, ‘my_profile_update’, 10, 2 ); function my_profile_update( $user_id, $old_user_data ) { // Do stuff with … Read more

Why does my file_exist check fail?

get_template_directory_uri doesn’t return the directory name, it returns the URL of the directory. file_exists needs a file path, not a file URL. Use get_template_directory instead, and don’t forget to check get_stylesheet_directory too for those using child themes

Plugin Theme CSS [closed]

You would be better off creating a child theme, this will ensure your edits do not get wiped out when you update Woo. Anyway, this CSS should work. I usually avoid using !important but without seeing your page it’s hard to say what is overriding your styles. .woocommerce #content div.product div.images, .woocommerce div.product div.images, .woocommerce-page … Read more

How can i delete options on plugin uninstallation?

This will give you the option to register your unistall hook during plugin activation. function myplugin_activation_callback(){ register_uninstall_hook( __FILE__, ‘myplugin_uninstall_callback’ ); } register_activation_hook( __FILE__, ‘myplugin_activation_callback’ ); function myplugin_uninstall_callback(){ //Perform your uninstall operations here delete_option(‘test_option’); } However, the simplest way is to use an uninstall.php file with the following codes: if (!defined(‘WP_UNINSTALL_PLUGIN’)) { die; } //Perform your … Read more

Warning: Use of undefined constant list_all – assumed ‘list_all’ (this will throw an Error in a future version of PHP)

There is a bug in this code: add_menu_page(‘Simple Table Manager – List’, ‘Simple Table Manager’, ‘manage_options’, $this->slug[‘list’], array($this, list_all )); The part array($this, list_all ) is a function callback, but there should be name of a function passed as string as second item in the array. So it should be: array($this, ‘list_all’ ) PS. It … Read more

AJAX on Front-End Button Click not working – Custom Plugin

Ok, so it’s pretty easy error – just a typo 😉 You use this line to localize your script: wp_localize_script( ‘ajax-script’, ‘my_foobar_client’, array( ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ), ‘we_value’ => 1234 ) ); So you use ajax_url field to store url to admin-ajax.php But you use this line in your js file: my_foobar_client.ajaxurl, and there … Read more