Set a default category – if the user didn’t select one- before creating a post

Maybe this is what you are looking for? Source is from @Michael Fields /** * Set default cat for cpt * @source {https://circlecube.com/says/2013/01/set-default-terms-for-your-custom-taxonomy-default/} * @source {http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/} * @license GPLv2 */ function set_default_object_terms_203962( $post_id, $post ) { if ( ‘publish’ === $post->post_status ) { $defaults = array( //’your_taxonomy_id’ => array( ‘your_term_slug’, ‘your_term_slug’ ) ‘post_tag’ => array( … Read more

is_search was called incorrectly

The Why part In the core is_search() function there’s a check if the global $wp_query is set: global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( ‘Conditional query tags do not work before the query is run. Before then, they always return false.’ ), ‘3.1.0’ ); return false; } Note that … Read more

Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?

If you look at the source code, you can see that wp_enqueue_style( ‘crayon’ ) is called in Crayon::enqueue_resources() which itself is called either from either Crayon::the_content() or Crayon::wp_head(). The code in Crayon::wp_head is: if (!CrayonGlobalSettings::val(CrayonSettings::EFFICIENT_ENQUEUE) || CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_FRONT)) { CrayonLog::debug(‘head: force enqueue’); // Efficient enqueuing disabled, always load despite enqueuing or not in the_post self::enqueue_resources(); } … Read more