The print_r function accept second parameter for return
so it retrun the variable instead of printing it.
print_r($expression, $return)
So you can do
error_log( print_r( $variable, true ) );
Related Posts:
- How to find error in my code when the error message is pointing to WP core file?
- “Undefined index” error when saving empty array with checkboxes
- Should I use spl_autoload_register() in my plugin?
- When to use Exceptions vs Error Objects vs just plain false/null
- Utilize WP-CLI from inside WordPress, not SSH
- error_log is not working as expected in functions.php file
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- “Notice: Undefined variable: content” is showing [closed]
- Same log message keeps on printing to debug.log file thousand of times
- Mute Debug Messages from Plugins
- Hooks for post saving make a post-new.php to load latest post’s data
- I am having errors with checkout on wordpress
- File is executed twice if plugin is activating
- How to identify which php file a plugin is using on page load?
- How to send logs to plugin owner for a plugin?
- I’m writing my first plugin and my echo output is showing up on every page of my wordpress installation
- global $post inside plugin query messes up every new post page in wp-admin
- Accessing Variables Used In a Plugin Using PHPStorm + XDebug
- WordPress won’t display errors at all
- WordPress White Screen Error
- Include WP_Query in my own PHP file?
- Using register_activation_hook in classes
- Hide php Notices in Dashboard
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- Is there a way for a plugin to add an attribute to the tag of a theme?
- How to use update and delete query in wordpress
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- Debugging an error: wp_enqueue_style was called incorrectly
- Resize Image without cropping
- Fatal error: Call to undefined function wpsc_cart_item_count()
- My shortcode is showing up twice
- Database “Migration” for Plugins?
- Using FirePHP with WordPress
- After upgrading to PHP 7.0 my contact form outputs error
- Does wp-cron runs all tasks scheduled at same time together or one after other?
- Making Quote Plugin more efficient
- Hiding WordPress Plugin Source Code
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- Will simple function names in a class structure conflict with other plugins?
- Instantiate class to be available to all plugin functions
- How to test nonce with AJAX – Plugin development
- wp_loaded hook block script enquequing
- WP nonce invalid
- How can i upload images in an admin page?
- PHP Warning: Attempt to read property “term_id” on bool
- Custom user login page by creating a plugin
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Reprinting tags with all attributes
- Update results, Before deleting the related category [closed]
- Adding function to Genesis genesis_header [closed]
- Error: options page not found
- how to update and display an option without reloading the page
- Which is the correct way to conditionally enqueue a CSS file?
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Plugin Generate Unexpected output during activation
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Undefined method class::construct() when creating a plugin
- Hook called before text widget save
- wpdb prepare insert table doesn’t work
- wordpress admin plugin menu custom css
- How to display SQL query that ran in WC_Order_Query?
- How can I find the cause of a 500 server error?
- how to Update 15k products on plugin activation with meta_option
- Using admin-post.php for admin form but it directs me to admin-post.php white screen
- How can I display Custom Post type Custom Columns and its Content in a Dashboard Widget?
- custom plugin with upload files does not work
- What is the difference between Null vs Empty (Zero Length) string?
- send popup after wp_redirect()
- no_rest_route error on custom routes
- Payment field disappears on custom Paypal plugin
- Illegal string offset in PHP function in via Theme Customizer
- Create ACF Checkbox to get all ACF Values from Parent Page
- Creating plugin with front-end pages
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- How to Send Pingbacks for all Posts in WordPress?
- Intermittent 503 Service Unavailable Error
- product_type_options get saved value [closed]
- Display a custom name when the user has no name settle in his account
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Sum All the Post Meta of Published posts of Current Logged in user
- Autoloading Classes in Plugins
- Notice: Undefined index: post_title error
- Comparing Dates within plugin using PHP If statement
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- Singleton plugin activation; create database
- See output of a sql query while plugin installation in wordpress
- How to get WordPress Adminmenu items?
- How keep woocommerce users separeted in multisite install and keep admins on network
- Import users and custom user meta from csv
- Implement OAuth2 in custom plugin
- Prevent users from display default wordpress login form
- login redirect based on user role not work as expected
- redirect user from login page if is logged
- How to lock users account until approvation
- Create custom table for wordpress custom registration flow
- Getting invalid user ID error when creating a new user with wp_insert_user
- Authenticate + Authorize WP REST API request before built-in WP JSON Schema Payload Validation?
- Error when loading Dashboard
- WordPress wp_set_object_terms does not assign product to custom taxonomy