Custom meta box includes

Debugging in WordPress

The following could/should be set in the wp-config.php file of your local(!!) installation – never do this on a live site, especially not when you got caching activated!

define( 'WP_CACHE',            false  );

// Show the development files for scripts/stylesheets and don't combine them
define( 'COMPRESS_CSS',        false  );
define( 'SCRIPT_DEBUG',        true );
define( 'COMPRESS_SCRIPTS',    false  );
define( 'CONCATENATE_SCRIPTS', false  );
define( 'ENFORCE_GZIP',        false );

// PHP and WP internal debug output + log
error_reporting( E_ALL );
@ini_set( 'display_errors', 1 );
define( 'SAVEQUERIES',      true );
define( 'WP_DEBUG',         true );
define( 'WP_DEBUG_LOG',     true ); // file: ~/wp-content/debug.log
@ini_set( 'log_errors',     'On' );
@ini_set( 'error_log',      WP_CONTENT_DIR.'/php_error.log' );
define( 'WP_DEBUG_DISPLAY', true );

Then always wrap your calls inside the following (assuming you’re ignoring the warnings and using it on your live installation):

  1. Turn of all caching solutions – else some visitor could still see your debug output.
  2. Wrap your debug inside if ( is_user_logged_in() ) { /* debug here */; }
  3. Even better: Only for admins: if ( current_user_can( 'manage_options' ) ) { /* debug here */; }

WordPress File Path & URI/URL functions

Path & URL

// The path to your current file
plugin_dir_path( __FILE__ );

// The URL to your current file
plugin_dir_url( __FILE__ );

Those ↑ come already trailing-slashed.

If you need only the foldername, wrap it inside basename().

If you need the admin URL, use get_admin_url( get_current_blog_id() ). Even easier is using self_admin_url(), which determines by itself if you’re in a network, single blog or on a user network-admin page.

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş