All Questions
7 questions
1
vote
1
answer
47
views
How to prevent XSS alter custom global javascript object & methods in Wordpress
Im working on a project in Wordpress that enqueues multiple .js files where each file adds
a new method to a global javascript object, this in order to make the desired methods available only if ...
1
vote
1
answer
1k
views
What is the proper method of using global $post?
I am using global $post multiple times in a class. These are my doubts
Is that a bad practice?
Can it result in slow websites?
What's the proper way to use it inside a class
class Test{
public ...
-1
votes
1
answer
91
views
Global Handle to Class unavailable in Plugin?
I am writing a custom plugin and calling the plugin functions using short codes on my wordpress page.
global $db_handle;
below declares the handle to the class 'DBController' global.
if (isset($...
0
votes
0
answers
85
views
Best way to access variables in template markup
I am making my own mini OOP wrapper for working with wordpress themes. I have a main $settings variable that contains all of the information like definitions, scripts, menus etc..
I then pass this ...
5
votes
2
answers
9k
views
When and Where is `global $post` Set and Available?
Usually when people think of the global $post object it's assumed that it's actually set whenever you enter The Loop. I started to play around with how early I could actually call global $post which ...
1
vote
1
answer
112
views
How to avoid repeatedly use the new statement to instantiate a class? [closed]
I have a Class with a lot of variables.
To get a variable, I have to write this line in each function:
$x = new MY_Class();
I guess there has to be another way?
I tried:
function my_data(){
global ...
6
votes
3
answers
9k
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 ...