Linked Questions

0 votes
2 answers
13k views

What is the proper way to get logged in user id in a plugin?

I need to get logged in user id inside my plugin. Is this the proper way? $root = dirname(dirname(dirname(dirname(__FILE__)))); if (file_exists($root.'/wp-load.php')) { require_once($root.'/wp-load....
PrivateUser's user avatar
  • 3,459
8 votes
1 answer
965 views

PHP code in page template vs functions

I've made numerous WordPress sites, and learned PHP practices that I believe to be right, i.e. functions go in functions.php file, nearly everything in functions.php should be wrapped in a function, ...
tmdesigned's user avatar
  • 1,655
3 votes
1 answer
291 views

Authoritative answer on which boots first - Plugins or Themes?

I can't seem to find anywhere in the WordPress documentation an authoritative answer on the question on whether a WordPress plugin boots first or whether a WordPress theme boots first. I need to know ...
Sophia_ES's user avatar
  • 155
1 vote
1 answer
338 views

Why does add_action() not run when placed in register_activation_hook()?

I have questions about executing add_action() in a Wordpress plugin. I was attempting to insert into the tag via the plugin i wrote. I had this (which never ran, btw) function tt_add_GA4_header() { ...
extensa5620's user avatar
0 votes
1 answer
538 views

Using "add_image_size" to register custom image sizes inside plugins not working

I noticed that most examples of add_image_size() is done via the after_setup_theme hook. Which means, for it to register, one has to switch theme and reactivate the theme. Which is not ideal for me as ...
arvil's user avatar
  • 139
0 votes
1 answer
26 views

Is functions.php in themes applied to all templates?

I've been reading the theme developer handbook for a bit and maybe I ended up with one too many questions on wordpress theme development. I haven't done any theme/php development in a very long time ...
allenskd's user avatar
  • 111
0 votes
1 answer
40 views

Only allow a plugin to work on a specific page? (Prefer not to use a plugin)

I know that there is an 'answer' to my question here but it has -2 votes. As the title of the question suggests - I am trying to allow a WordPress Plugin to ONLY execute on a template. What is the '...
Henry's user avatar
  • 983
0 votes
1 answer
892 views

Why can't a custom postype be registered with "admin_init" hook?

Why do I need to use the "init" hook instead of the "admin_init" hook? init:fires after the core of the wordpress is loaded but before headers are sent admin init:before any other hook when the user ...
Johnthomas's user avatar
0 votes
1 answer
593 views

How Wordpress understands what do with the (all) key in the $wp_filter array? [duplicate]

In the isset( $wp_filter['all]), the all key will fire for all other hooks. i need to know how Wordpress understands what to do if the key all is used.. It should be defined somewhere which make ...
Mohamed Omar's user avatar
0 votes
1 answer
1k views

how does the rendering works?

i am trying to get a rough idea about how Wordpress renders the final content, built-in and plugin content. Rendering means to me, manipulating direct or indirect(delay via ajax,..) the DOM. To keep ...
stackoverclan's user avatar
0 votes
1 answer
67 views

include plugin folder directly in theme folder to load faster page n wp

include plugin folder directly in theme folder to load faster page in wp? Load jquery in the footer and the jquery load from plugin installed also.
user13401's user avatar
-1 votes
1 answer
63 views

Need to use an external variable inside a function

Need help with a theme I'm working on. Basically I have a variable that's set early called $type <?php if ( preg_match( "/^kssm-/i", $licensekey )&& preg_match("/@/i", $licensekey) == ...
Ivan's user avatar
  • 1
-2 votes
1 answer
2k views

How to pass variable to functions.php?

I have a variable, created in page.php, and would like to pass this to a function in functions.php. Possible?
Keith's user avatar
  • 1,546
0 votes
0 answers
449 views

How can I get the Post ID and Post Type within a Must Use Plugin?

I'm trying to get the Post ID and the Post Type inside of my MU Plugin; functions like: get_the_ID() and get_post_type() return false, instead of the desire values. I read that many functions are ...
Roel Magdaleno's user avatar
0 votes
0 answers
1k views

How to use a shortcode of a plugin in another plugin php file

I'm trying to implement reservation function in my web with two plugins of wordpress. Two plugins are reservation plugin and payment plugin, respectively. Reservation plugin has some steps for ...
Attorney's user avatar

15 30 50 per page