Debugging – logging database queries

The debug log will only capture PHP-generated errors as well as things you manually send yourself. So if it is not being created right now, then there are no warnings/errors being generated by PHP right now. In order to send things manually, you use error_log(). One quick note though is that you have to set … Read more

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

when you want interaction between client side and server side you should use ajax . i think this Link will be very helpful to you 🙂 Put this in your javascript var data = { action: ‘is_user_logged_in’ }; jquery.(‘.x-btn-widgetbar’).on(‘click’,function(){ jQuery.post(ajaxurl, data, function(response) { if(response == ‘yes’) { // user is logged in, do your stuff … Read more

Several times request to load plugins when sending one request

That might well be, but that’s alright. There might be redirects happening, and those will result in multiple requests. The WordPress-Cron System relies on AJAX-requests, those will also show up in the log. If you load any resources (images, scripts, stylesheets) that do not exist, WordPress will be loaded and handle the 404, resulting in … Read more

Debug log file with rolling datestamp in filename?

Well, yes – there is such way. And you even have the solution already in your code… Even more – you almost solved it yourself… This line decides, where the log will be located: @ini_set( ‘error_log’, dirname(__FILE__) . ‘/wp-content/debug.log’ ); So all you need is to add date in that file name. Like this: @ini_set( … Read more

Log Author Actions

There is a plugin called Audit Trail. It will pretty much log all actions for your wordpress backend such as page creation / deletion, post creation / deletion, logging in / logging out. You can find it here: http://wordpress.org/extend/plugins/audit-trail/

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

I wanted to restrict my website except a specific page. This is my solution: function restrict_access_if_logged_out(){ global $wp; if (!is_user_logged_in() && !is_home() && ($wp->query_vars[‘pagename’] != ‘name-of-page’) ){ $redirect = home_url() . ‘/wp-login.php?redirect_to=’ . esc_url($_SERVER[“HTTP_HOST”] . urlencode($_SERVER[“REQUEST_URI”])); wp_redirect( $redirect ); exit; } } Only I added this: && ($wp->query_vars[‘pagename’] != ‘name-of-page’) in IF clause and a … Read more