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

Content expands beyond its column container [closed]

As far as I can tell, the most right column is being nested within the middle reviews column. I imagine that somewhere in the code (template, sidebar, or widget) there is a conditional statement causing your middle column to not get closed off before the right column starts. To illustrate what is happening, this is …

Read more

How to make 3 boxes like this screenshot has?

Your question is far too broad; you need to look at the CSS and HTML source and theme that site is based on to find out how that layout is done. Look at other free WP themes to find a similar layout. And learn how to use Firebug with Firefox, or use the developer tools …

Read more

FATAL ERROR: WP complains about redeclaration [closed]

Wrap your function with !function_exists() to avoid a redeclare error. if( ! function_exists(‘FAvideoid’) ) : function FAvideoid() { return $wpdb->get_var( “SELECT ‘video_id’ FROM $wpdb->ytvideos ORDER BY RAND() LIMIT 1;”); } endif; Or to reduce the code from being imported more than once: include_once “FA-db.php”; include_once “FA-admin.php”; include_once “FA-ad.php”; But probably the best route is to …

Read more

Custom single-product page for product from category x

Assuming that the taxonomy you want to check is product_cat and the term for which you want change template is special and finally assuming that the file you want to use for this special category is named special-single-product.php and resides in the root of your theme, the code you have to use is: add_filter(‘template_include’, ‘special_single_product’); …

Read more