Articles of logging

How to dump/log default values that are passed to hooks/filter functions?

Here’s a quick example of I am trying to achieve: I am using this filter: add_filter(‘manage_edit-member_columns’, ‘set_custom_edit_member_columns’); function set_custom_edit_member_columns($columns) { $columns[‘photo’] = “Photo”; return $columns; } The function has one parameter passed ($columns). I want to see what’s inside of $columns. By the example in the codex, I know it’s an array with column names. […]

Sidebar button click redirect when user is not logged in instead displays it

in my web I have a button (.x-btn.widgetbar) that displays a section of widgets in the upper right as in this example. I have modified the icon to change based on whether the user is registered or not, I would like that when the user is not logged in redirect to a login page instead […]

How to catch all PHP errors with custom error handler?

I would like to know is there any way to catch all PHP errors (not only WP Errors) in WordPress without modifying core? The reason I am asking is that I would like to manually catch all errors and use third party software as an error aggregator, for example Sentry, but not limited to. for […]

Several times request to load plugins when sending one request

When we sending 1 request to load any page (Home, Single or etc), WordPress running more than several times. For example you can adding the below code in the main plugin file or functions.php in current theme and you can see the log file! file_put_contents(‘log’, print_r($_REQUEST, 1), FILE_APPEND); I need a solution to fix/skip this […]

Log Author Actions

Is there a place where actions like post creation/deletion, page creation/deletion, modification, etc. is saved? Is this stored in the Apache logs? If this is not saved, is there a way (plugin?) to do this?

I restricted wordpress by logged users. It's possible exclude a page?

Here is my code for restrict my wordpress site: function restrict_access_if_logged_out(){ if (!is_user_logged_in() && !is_home()){ $redirect = home_url() . ‘/wp-login.php?redirect_to=’ . esc_url($_SERVER[“HTTP_HOST”] . urlencode($_SERVER[“REQUEST_URI”])); wp_redirect( $redirect ); exit; } } add_action( ‘wp’, ‘restrict_access_if_logged_out’, 3 ); Now I want to add one exception for example for URL: example.com/home-page.

How do I show a different homepage to logged in and non-logged in users?

Basically, I want to show non-logged in users a page that says ‘register or log in.’ But I want to show logged in users a standard homepage will all my posts.

wp_set_current_user (remote logging) doesnt work on server

I am figting with one interesting problem. I am logging in user with authorization on remote server. The problem is that it is working fine on a localhost but not on a server. Here is code I am using: function userSignIn() { $token = $_GET[‘key’]; $userOp = getUserFromOP($token); if ($userOp != null && is_array($userOp)) { […]

buddypress activity social share

Hello Guys I am using buddypress and I am sharing activity on social network like facebook and google and I am using url like https://www.facebook.com/sharer/sharer.php?t=’ . $activity_title . ‘&u=’ . $activity_link . ‘ buy when facebook crawls the page it is not logged in so it redirects to home page so instead of sharing the […]

Preferred Method of debugging a wordpress SQL calls?

What is your preferred method of debugging WordPress Applications when writing custom behind-the-scenes SQL calls, etc. ? Coming from a Rails background, I usually tail a log file that displays not only all the processes and views that are being seperately loaded into a template, but if there is an error, it will pin point […]