How can I show a button in WordPress but make it unclickable unless logged in?

You didn’t provide any code so I’ll give you some pseudo code and you make of it what you will: Your HTML button: <a href=”<?php echo $download_url; ?>” class=”download-button<?php echo $is_disabled; ?>”>Download</a> Now, you’re going to want to write some CSS style rules for the following: .download-button{} .download-button.disabled{} Make one look like a bright, vibrant, … Read more

Update user role for expired membership

If you need to get the value of a field in a custom database table you can try using an SQL query. You’ll have to check the column or table name to construct final version of the query. add_action( ‘profile_update’, ‘my_profile_update’, 10, 2 ); function my_profile_update( $user_id, $old_user_data ) { global $wpdb; $status = $wpdb->get_var( … Read more

change user password REST API

This question is from 9 months ago and maybe it is solved right now. but I’ll send the answer to help other people who may have this question: You have to install JWT plugin. Then, you have to create Bearer Token by POSTing a username and password to this address: https://example.com/wp-json/jwt-auth/v1/token In postman, you have … Read more

current_user_can() causing critical error

The problem is that wp_get_current_user (which current_user_can relies upon) is pluggable, which means it isn’t loaded until after plugins are loaded (to give plugins a chance to override it). That means it’s not available to call from the top level of a plugin file. Instead, I’d make the role check inside the hook e.g. function … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)