wp_logout action hook is not firing

In your code, get_current_user_id() will return 0 because this hook fires after the logout has happened, ie, there is no current user ID. If you want the $user_id to be available to your function, you have to pass it in. Note: the $user_id parameter was added in WordPress 5.5.0. If you’re using an older version, … Read more

Mixed results with is_page() WordPress function, when using $this, or self

You’ve shared that this is how the member variable is defined: class PropertySearch { private static $listing_details_template_name; This means it is a private static variable and can be accessed using static accessor such as self::$listing_details_template_name or PropertySearch::$listing_details_template_name. Additionally, you’ve declared that it’s a private member variable, so it can only be referred to from within … Read more

stop resize button for wordpress media

That’s a bit tricky because WordPress doesn’t offer this functionality out of the box. But a workaround would be to stop WordPress from generating additional image sizes for uploaded images. But it will apply to all image uploads, not just those in the WooCommerce product gallery. If you wanted to try it out, here’s the … Read more

FATAL ERROR when I try to change the .php according to required and optional items rule

Nectar_Arrow_Walker_Nav_Menu apparently extends the WordPress Walker class. This means that its methods’ arguments need to match the original class methods’ arguments: public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {} The WordPress class doesn’t have any optional parameters so it doesn’t have this issue. Make sure your method’s arguments match WordPress’ and don’t … Read more

ENV for WordPress

As I don’t know why rails prefer to store such secrets in an environment variable the answer might not be complete, but if the reason is to avoid having it in the code and therefor accessible to everybody with access to the code (via git or misconfigured web server), wordpress has two ways to do … Read more