wordpress Ajax success doesn’t return the value

You can try this… …rather than returning the value, send a JSON success message. $response = new WP_REST_Response($final_price_return, 200); wp_send_json_success( $response ); wp_die(); //you have to end the process, so if you’re getting just a 0 returned in your JS success, it’s because of this. Then, in your JS/jQuery: success: function (success, data) { var … Read more

WordPress Hooks : Where to place callbacks that repetitively yield the same effect?

Long-running software may be able to register functionality once and leverage those registrations for every connection across the lifetime of the process, but in the case of WordPress (and most of the PHP web software landscape as a whole) the long-running connection management is offloaded to the web server software. WordPress executes from the top … Read more

I want to disable certain file types from upload from dokan description field

The code you have added has an undefined constant which might create an issue with the latest PHP versions. Instead, you may use the code given below which will allow you to add media to the short description and description. add_filter(‘dokan_product_short_description’, ‘add_media_button’); add_filter(‘dokan_product_description’, ‘add_media_button’); function add_media_button(){ return array( ‘media_buttons’ => true ); } After adding … Read more

How to delete Password Protected posts cookies when a user logged out from the site

The post password cookie is set with: setcookie( ‘wp-postpass_’ . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST[‘post_password’] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); in the wp-login.php file. We can then use the clear_auth_cookie hook, in the wp_clear_auth_cookie() function, to clear it on logout: /** * Clear the Post Password Cookie on logout. * * @link http://wordpress.stackexchange.com/a/198890/26350 */ … Read more

Is it possible to know which menus are owned by a plugin?

Technically speaking, you can use PHP’s debug_backtrace() function along with appropriate WordPress hooks like wp_nav_menu, add_menu_page etc. to get the file names and function names these WordPress API functions/hooks are called from. From there, you should be able to determine which plugin is creating or modifying what menu. However, please note that functions like debug_backtrace() … Read more