Using global $post v/s $GLOBALS[‘post’]

There is no difference when you are using just echo. What works different is unset(): function test_unset_1() { global $post; unset( $post ); } function test_unset_2() { unset( $GLOBALS[‘post’] ); } test_unset_1(); echo $GLOBALS[‘post’]->ID; // will work test_unset_2(); echo $GLOBALS[‘post’]->ID; // will fail The reason is that unset() destroys just the local reference in the … Read more

get_post() vs global $post or $GLOBAL[‘post’]

In essence, for all technical purposes, get_post() == $post == $GLOBALS[‘post’] As @tosho already explained in the linked post, $post === $GLOBALS[‘post’], so I will not go into that. What we are interested in is, how is get_post() the same. For this, we will need to look at the source code. As you can see, … Read more

How to: inspect global variables in WordPress

Or, if you’re lazy, just install the Debug Bar plugin. It adds a button to the admin bar that, when clicked, reveals a panel with all kinds of useful information, including deprecation notices, WP_Query variables and an SQL query log.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)