How can I reactivate a plugin without access to my dashboard?

You can do this by editing the database via PhpMyAdmin. Go to your database’s Options table and find a row called active_plugins. You should see something like this… a:10:{ i:0;s:49:”1and1-wordpress-wizard/1and1-wordpress-wizard.php”; i:1;s:29:”acf-repeater/acf-repeater.php”; i:2;s:30:”advanced-custom-fields/acf.php”; i:3;s:45:”limit-login-attempts/limit-login-attempts.php”; i:4;s:27:”redirection/redirection.php”; i:6;s:33:”w3-total-cache/w3-total-cache.php”; i:7;s:41:”wordpress-importer/wordpress-importer.php”; i:8;s:24:”wordpress-seo/wp-seo.php”; i:9;s:34:”wpml-string-translation/plugin.php”; } You can add a new row for your plugin. You will need to know the following. … Read more

Custom preview_post_link not working for draft post

I encountered the same issue and after some research, I came across the following solution. For context, there is a bug on gutenberg and there is no platform specific way to change the preview link yet. Add the following code to your functions.php: // Workaround script until there’s an official solution for https://github.com/WordPress/gutenberg/issues/13998 function fix_preview_link_on_draft() … Read more

Show “Local Pickup” shipping method only for specific Woocommerce product categories [closed]

The following will only show “Local pickup” shipping method for specific product categories in cart: add_action( ‘woocommerce_package_rates’,’show_hide_local_pickup_shipping_methods’, 10, 2 ); function show_hide_local_pickup_shipping_methods( $rates, $package ) { // HERE BELOW your product categories in the array $categories = array( ‘t-shirts’, ‘hat’ ); $term_found = false; // Loop through cart items foreach( $package[‘contents’] as $cart_item ){ if( … Read more

WP Mail SMTP: What do the SSL/TLS options mean? [closed]

WP Mail is just a wrapper for configuring WordPress’s PHPMailer (wp-includes/class-phpmailer.php). PHPMailer’s documentation says: Encryption flavours There are two “flavours” of transport encryption available for email: “SMTPS”, also referred to as “implicit” because it assumes that you’re going to be using encryption right from the start of the connection. In PHPMailer this mode is selected … Read more

When is it useful to use wp_verify_nonce

Yes, nonces should always be used when an authenticated user is triggering an action via a GET/POST request. One of the main purposes of the nonce is it ensure that the current user actually intended to trigger this request. It prevents the security vulnerability known as Cross-Site Request Forgery (CSRF), where an attacker can trick … Read more

Send emails with wp_mail() using SMTP configured in plugin

When you’re using something like Easy WP SMTP, what you’re doing is configuring things so that wp_mail() sends using your validated SMTP account rather than the generic mailer on the web server. The a common confusion and misconception is that you are using SMTP OR wp_mail(). Actually what you’re doing is changing what wp_mail() is … Read more

Get page slug in Admin menu

A fast and easy solution is to fetch the slug with $_GET[‘page’]. Don’t forget to do some safety checks on the query after getting it. Also, while i’m on it, to make the submenu items show up below your top level you need to change the first property of add_submenu_page to your top level slug. … Read more