0
votes
0answers
48 views

Wordpress $GLOBALS and PHP $GLOBALS

Is the php $GLOBALS associative array over written in WordPress with the WordPress $GLOBALS? I have a piece of code that uses $GLOBALS['myvariablename'] to access a global variable. It works in php, ...
0
votes
1answer
54 views

key( $GLOBALS['wp_registered_sidebars'] ) is always showing the same value

I am using this code from another answer add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr( $widget ) { static $counter = 0; // right sidebar in Twenty Ten. Adjust ...
1
vote
3answers
10k views

How to set and use global variables? Or why not to use them at all

UPDATE: My original question has been solved, but this is turning into a valid discussion about why not to use global variables, so I am updating the question to reflect that. The solution was ...
0
votes
1answer
195 views

Where is this function's callback getting its arguments from?

This might be better suited to Stack Overflow, thought I'd try here first though. I was walking through this tutorial by Justin Tadlock and encountered the function below being used as the callback ...
4
votes
4answers
2k views

Where to get information about array fields in $_REQUEST?

I just started to learn PHP and doing things with WordPress and I am a bit confused about information in Codex. Was told that Codex got all info I required but I got stuck with it. What array fields ...
0
votes
1answer
2k views

How to call a function only once (global variable scope)

I have been trying to work out the most effecient way to use functions in WordPress. I have a big slow function big_slow_function() that ideally is only run once. But I need to use the boolean that ...
4
votes
2answers
2k views

Does an activated plugin automatically mean its methods are available to other WP functions?

I made a WordPress plugin like this: Class MY_CLASS { //codes } Global $myclass; $myclass = New MY_CLASS (); After installed and activated the plugin, can I use this class in other plugins without ...
1
vote
2answers
724 views

Call External Object in Class Function During Callback

I've a class which has a function that check and creates table in database. In order to do so i need to use WordPress $wpdb object. I need the function to run only on first plugin activation, so i ...