New answers tagged

0

Your shortcode can look like this: [check-if-empty usermeta="last_name"] Is not empty [/check-if-empty] The parameter called "usermeta" is added to your function ($atts) and it's value is used to check the userdata. function func_check_if_empty( $atts, $content = null ) { if ( is_user_logged_in() ) { /* check if logged in */ ...


0

As per the requirement in the comments, one way to do that rewrite is with .htaccess. This may be possible with Wordpress rewrite functions too, but I find .htaccess easier as there are some constraints with the Wordpress functions. If your Wordpress installation is at http://localhost/wordpress then your .htaccess should be in the wordpress directory. Add ...


1

There are many ways you can achieve this... In your instance, as you pointed out $wpdb, here is the possible ways you can achieve this: 1. Use $wpdb::query You can run this query directly using $wpdb's query method as: add_action("init", "username_query") function username_query(){ global $wpdb; $prefix = $wpdb->prefix; ...


0

wp_redirect sends a HTTP header to the browser. Once HTTP headers are sent, that's it, they're gone, you can't add anymore. However, you called get_header and rendered some HTML. To do this headers need to be sent to the browser telling it to expect a HTML page. So by the time you load edit-profile-proccess.php, it's too late. Headers have already been sent, ...


0

Since you're using a JWT for the current user (that is logged into WordPress), you can use this endpoint: /wp/v2/users/me https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user-2 You can also check the token to see what claims are available at https://jwt.ms


Top 50 recent answers are included