How to get the WordPress user role from the database

  Рет қаралды 1,877

Joshua Herbison

Joshua Herbison

Күн бұрын

Пікірлер: 14
@jherbison
@jherbison 3 жыл бұрын
I do a lot of database queries and it helps a lot to be able to connect the user to the user role in a database query.
@viktorshevchenko3888
@viktorshevchenko3888 3 жыл бұрын
Thank you so much for this video with detailed explanations.
@jherbison
@jherbison 3 жыл бұрын
You’re welcome. Thank you for watching and commenting.
@Daud181
@Daud181 3 жыл бұрын
Cool great video
@jherbison
@jherbison 3 жыл бұрын
Thanks.. It is still processing I think.
@pkg2885
@pkg2885 2 жыл бұрын
Thank you for all your videos ... ^^ Very much enjoy learning code from you. I am now subscribed for your channel ^_^
@jamllesol8796
@jamllesol8796 2 жыл бұрын
Haven't tried it but this is amazing
@stefanpfadt4353
@stefanpfadt4353 2 жыл бұрын
Hi great video! I am a non-coder and wwant to ask how you would go about this scenario: I have a search form on my website and I want specific search fields only visible to certain user roles, so subscriber can only see first search field, contributor can see 2 and so on. What steps would I have to take? Code/function wise? I appreciate any input or suggestion ;)
@theman7050
@theman7050 3 жыл бұрын
Joshua, under what circumstances is it ok to query the database back and forth like this? I mean ive heard that repeated queries directly to database affect site speed. Is it correct? Coz I run into situations where I cannot make CPT for everything and database tables appear to be more feasible. So how to draw the line there?
@jherbison
@jherbison 3 жыл бұрын
Thank you for the question. WordPress already uses over 40 database queries for their default theme page load. I like to limit the queries as much as possible. I remove as much of WordPress default queries to get it down to about 19 for a page load. So I feel adding a couple of my own queries is fine. Plus, I like speed and this is the reason I do my own queries. If you do a generic get_user_by database query, it return the entire user information as an object. I slim down the query by only requesting what I need from the user information. Hope that helps.. Thank you for watching and commenting.
@raj080288
@raj080288 3 жыл бұрын
What extension are you using to pre supply the php snippet?
@jherbison
@jherbison 3 жыл бұрын
I create most of my snippets myself. I did a video a couple of weeks ago on sublime text snippets. kzbin.info/www/bejne/iGe0hWyllrJqfLs
@jherbison
@jherbison 3 жыл бұрын
Thank you for watching and commenting.
@raj080288
@raj080288 3 жыл бұрын
@@jherbison thank.you for providing such great content. Looking forward to more videos
Create a Shortcode Plugin that uses ob_start() function to return data
15:19
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 67 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 80 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 11 МЛН
What is the difference between JSON and PHP Serialize
18:50
Joshua Herbison
Рет қаралды 1,5 М.
Create WordPress Custom User Role for Custom Post Type
47:48
Vicode Media
Рет қаралды 7 М.
How To Make a WordPress Website - 2024
1:22:19
Tyler Moore
Рет қаралды 487 М.
WordPress Tutorial on how to create a GDPR WordPress Plugin
1:37:05
Joshua Herbison
Рет қаралды 3,6 М.
How to Create a Registration and Login page for your WordPress website
21:24
Use Contact Form 7 to Collect User Data & Display it on WordPress
13:53
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 67 МЛН