Linked Questions

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
537 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
8 votes
1 answer
964 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
-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
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
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
4 votes
2 answers
647 views

$wp_query initiation?

I'm wondering when does WordPress initiate its main query which sets the global $wp_query and enable us to use has_posts() and the_post() functions. If I create a page using archive template, how does ...
TurtleTread's user avatar
2 votes
4 answers
2k views

How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks

We know that there is a certain order for the execution of callback functions attached to action hooks. How does WordPress decide which action should be prioritized while executing all the hooks?
IAmDhar's user avatar
  • 96
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
3 votes
2 answers
3k views

Which functions in theme or plugin load first

I created a plugin to override a theme's function. As I learn that function in plugin loads first but I got an error Fatal error: Cannot redeclare wooc_extra_register_fields() (previously ...
user2834491's user avatar
2 votes
2 answers
438 views

WordPress classes explained

Are there any books, websites or lectures that explain the built-in WordPress classes? I would really like to learn how WordPress works internally. I've dug up the core files on trac and even went ...
Siddharth Thevaril's user avatar
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

15 30 50 per page