Set cookie using GET variable

Just check if the variable is set, using the code from your link: add_action( ‘init’, ‘set_agent_cookie’ ); function set_agent_cookie() { if (isset($_GET[‘code’])) { $name=”agent”; $id = $_GET[‘code’]; setcookie( $name, $id, time() + 3600, “https://wordpress.stackexchange.com/”, COOKIE_DOMAIN ); } }

How to create custom variables in the wp-config

Why do you need this? In wp-config you can set defines. They will be accesible everywhere without needing to use globals. Define something: define(‘MY_DEFINE_NAME’, ‘THE_VALUE’);. Then in your templates you can show the value like this: echo MY_DEFINE_NAME; Or set the value to a variable: $var = MY_DEFINE_NAME;.

WordPress variables and memory

Your installation might be … less than optimal. Using my Mini Theme, no plugins and the following code on the front page right after the opening body tag … print count( $GLOBALS ) . ‘ $GLOBALS<br>’; print @count( get_defined_vars(), 1 ) . ‘ variables<br>’; print count( get_defined_constants( TRUE )[‘user’] ) . ‘ constants’; … I … Read more

What are all the Properties of the WordPress Post Object?

Post object is mostly queried row of wp_posts database table with some extras. It is easy to dump content of one and see: object(stdClass) public ‘ID’ => int public ‘post_author’ => string public ‘post_date’ => string public ‘post_date_gmt’ => string public ‘post_content’ => string public ‘post_title’ => string public ‘post_excerpt’ => string public ‘post_status’ => … Read more

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