Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts? [duplicate]

This question already has an answer here: Closed 9 years ago. Possible Duplicate: Where is the right place to register/enqueue scripts & styles According to wp_enqueue_script() documentation in Codex, it seems that one should hook wp_enqueue_script() calls to the wp_enqueue_scripts action instead of wp_head. That contradicts all the tutorials I have ever read on the … Read more

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 the answer because an important development decision I am working on depends on it – as it is related to themes … Read more

What does the raw value for the get_bloginfo’s filter argument exactly do?

The $filter argument for the get_bloginfo function has a default value of raw but WordPress’ Code Reference didn’t mention another allowed values. What this raw stands for and what are other possible values if any? 1 Answer 1 We have the following filters added by default (source) add_filter( ‘bloginfo’, ‘wptexturize’ ); add_filter( ‘bloginfo’, ‘convert_chars’ ); … Read more

Add Option if Not Exists

I need to see if an option, and if does, get the value. If not, I need to add it. The Codex provides: <?php $option_name=”myhack_extraction_length” ; $new_value=”255″ ; if ( get_option( $option_name ) != $new_value ) { update_option( $option_name, $new_value ); } else { $deprecated = ‘ ‘; $autoload = ‘no’; add_option( $option_name, $new_value, $deprecated, … Read more

Issues enqueueing parent & child theme stylesheets with revised Codex method

This post brings up a few questions I’ve encountered pertaining to the recent changes around stylesheet enqueueing methods brought up in this thread and this thread. The issues I encountered came up in a general use-case scenario, using a widely used and well-maintained parent theme that is specifically child-theme ready on a WP 4.0 install. … Read more

Is the codex no longer actively maintained?

I generally Google when I need a quick reference for a WordPress function, and generally it’s a Codex post that comes up first (eg. https://codex.wordpress.org/Function_Reference/get_term when Googling ‘get-term’). I’ve been relying on the codex for years, and was vaguely aware that there was a separate Code Reference (eg. https://developer.wordpress.org/reference/functions/get_term/) that did give more detail than … Read more

What does is_page_template() compare against?

Looking through the WordPress documentation, it says that is_page_template() compares against a “template name”, if one is provided. I have a template stored in page-homepage.php called Homepage: /* * Template Name: Homepage * Description: The template for displaying the homepage */ And I have some code I wish to run in my functions.php when I’m … Read more