Here is the solution I’ve made that it’s now working properly:
function getCurrentUserRole() {
if (isset($this->data) && isset($this->data->{$this->cap_key}) && is_object($this->data) && is_array($this->data->{$this->cap_key}) ) {
$result = array_keys($this->data->{$this->cap_key});
} else {
$result = array();
}
return $result;
}
Related Posts:
- How to customize WP_Error (REST JWT authentication plugin) [closed]
- How can I use WordPress functions in my stylesheet?
- Plugin or mod for wordpress to make content publication SUPER easy
- WP showing “warning: call_user_func_array()”, What to do?
- Cropping, Re-sizing and Saving images from one folder to another folder in wordpress
- How can I pass a variable to wp_ajax action?
- How can i change an image’s author?
- Creating search filter through plugin
- WP-Members redirect if member ALREADY logged in
- How to edit/delete single row items in a table on my own menu page
- Displaying Gravity Form data on WordPress page [closed]
- Get a list of galleries from an album in NextGEN Gallery [closed]
- Undefined property: WP_Post_Type::$ID
- Plugin exceeds memory limit
- How to trigger $_GET request within admin plugin page?
- Wp favorite posts get user favorites in profile using buddypress [closed]
- How to ‘clone’ a wp plugin to make small changes
- add mediaelement.js plugins into WordPress video player control bar
- Preferred way of cacheing a value in php
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Automatically add attributes to woocommerce product?
- Edit Yoast SEO breadcrumbs output [closed]
- Adding a slider captcha to the comment system
- How to put JQuery/Ajax inside shortcode?
- Query all customers/users and check for duplicate information
- WordPress function not being called from jQuery method
- WordPress WPforms customization
- wp_remote_get() returns 403 while file_get_contents() does not
- How to save inputed data in a textbox [EDITED] [duplicate]
- Replace default og:image tag YOAST
- Where these .js file come to source code?
- WordPress Widget Not Saving Data
- WordPress Payment gateway add on form , how to add form into list or else how to submit form to next step for payment
- Center and hide overflow of WP toolbar custom links
- How I can internationalize variables within the function _e () __ (), etc?
- Notify comment author upon reply
- WordPress get_avatar function not correct working
- How to Create a shortcode to this php function
- My single.php page does not show the related data to the post which is clicked
- Creating a CSV with PHP inside the plugin directory
- pagination on data fetched using SQL query
- How to check if a taxonomy not exists in a plugin
- How passing values to construct function with Actions?
- add_action into another add_action not working
- Access a particular field in an array
- wordpress add_action() issue in ajax call
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- JQuery prepend a function
- Add User Role: Pre-saved in User-Meta [SOLVED]
- How to make a dynamic css class whose name changes every visit to confuse scraper
- I am trying to make a field show and save from quickedit screen
- Send email with list of active plugins upon activation/deactivation
- How WordPress core manage the plugin installation
- Shortcode not working – quotes seems strange
- Using custom fields for image alt and title
- How to display registered customer list as dropdown in WooCommerce checkout?
- “Allowed memory size” problem [closed]
- Echo out element to another page.
- Trying to get property of non-object wordpress error message
- Advertising: Every page refresh counts as 3 ad impressions
- WordPress Cache delete on plugin uninstall
- How to create repeater field manually, without plugin (ACF Pro)?
- Woo-commerce Update price as a Bulk from My offline software export
- How to disable login in iframe which is hosted in same domain?
- Display Author name PHP (Selfmade Plug-IN)
- WordPress jQuery Post – Amending Variable Value Within Function Command
- how to display recent post by category on home page
- WordPress Custom Hook with Class method
- Open_basedir errors – But setting basedir to none redults in 502 Bad Gateway
- Display top level parent category as a single product body class (Woocommerce)
- Allow a particular user to access a particular plugin?
- WordPress Standard Fix Errors
- How do I use a plugin’s shortcode attribute value in another function?
- Change the address of the music player if not available
- WordPress hide post from custom post-type on a single page
- update_post_meta is not working for me when I use e.preventDefault for update button
- Try to debug a plug-in written by someone else
- Use modulo condition in ACF repeater Field
- Add a WooCommerce Product Variant with attributes programmatically
- Redeclare a plugins function/class in my theme?
- Site broken by unedited php?
- Return function results within shortcode
- Help with customising love it plugin (use within foreach)
- Plugin communication between sites that use it?
- How to echo a plugin’s function into a template?
- Theme editor removes backslashes
- It possible to implement an adhoc php web application with wordpress?
- Plugin Hook: Get posts
- What is the process for reimplementing a back up WordPress?
- Showpost and last
- date function not correctly returning date
- Undefined variable _POST
- How to prevent page load on form submission
- how to add “alt” for all image in wordpress
- How to add a text in the checkout page woocomerce?
- How to add custom html to the Media > Attachment Details modal?
- Displaying Category Feature image on loop
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- WordPress broken dashboard with ninja-shell text
- Fields are not displayed on front end under custom php code in Advanced Custom Fields and Flexible Content field WordPress