How can one use variables in a template or template part without polluting the global scope?

I feel there is a bit of confusion — let me try and clarify some key concepts. A WordPress installation can potentially run huge amounts of 3rd party code. Code you can’t control. That leads to a high chance of naming collisions. That’s why WordPress coding standards suggest to “namespace” functions and variables declared in … Read more

Passing value from one hook to another

The solution for this was a compromise I moved the code from the wp_login hook into my meta_links function and test to see if my value exists function dk_plugin_meta_links( $links, $file ) { if($latestversion == “”) { //get the latest version if we don’t already have it } (do something with) $latestversion; } add_filter( ‘plugin_row_meta’, … Read more

How to store wordpress title in a variable

You’re example is totally unclear. What is ngegrab, what is $unity, $yesPage and what do you mean with “WordPress title”? Short: what are you trying to do exactly? To get the title of a post, use get_the_title() as mentioned in the other answer. To get the document title (<title></title>), use wp_get_document_title().