How to perform a query at the URL?

The reason behind this is how the URL rewriting works. No matter what is the setting of your permalink structure, all the requests will be redirected to index.php. So, for example: example.com/category/travel will eventually turn into: example.com/index.php?cat=travel So in your example: example.com/category/travel/?year=2007 will be turned into: example.com/index.php?cat=travel&year=2007 and possibly because the last argument overrides the … Read more

Change URL structure of subcategory archive pages

You answered your own question yourself. You want links to custom categories to look like this {taxonomy_slug}/{parent_term}/{child_term}/{grandchild_term}/ so you should pay attention to two parameters in the register_taxonomy() arguments: hierarchical and rewrite. $args = [ ‘hierarchical’ => true, // <– term may have a parent ‘labels’ => $labels, ‘rewrite’ => [ // hierarchical urls, defaults … Read more

What’s the proper way to use wp_enqueue_script/style?

Do this at the head of your functions.php: define(‘PATH_TO_URL’, get_bloginfo(‘template_url’) . [path to your libraries, etc.]); Then, just call wp_enqueue_script(‘script’, PATH_TO_URL . ‘myscript.js’); or similar anywhere you want. If you change the location, just change the define() and it’ll update everywhere. Easy peasy.

How do i reference the theme path in pages for images?

Use get_template_directory_uri() print get_template_directory_uri() . ‘/image.jpg’; In child themes use get_stylesheet_directory_uri() if you have replaced the image. In a shortcode this would look like this: <?php /* Plugin Name: Theme URI Shortcode */ add_shortcode(‘theme_uri’, ‘wpse_66026_theme_uri_shortcode’ ); function wpse_66026_theme_uri_shortcode( $attrs = array (), $content=”” ) { $theme_uri = is_child_theme() ? get_stylesheet_directory_uri() : get_template_directory_uri(); return trailingslashit( $theme_uri … Read more

Set template based on query in URL

There are a number of template filters available to override template selection. For a single post you can use the single_template filter: function wpa_single_template( $template ) { if( isset( $_GET[‘template’] ) ) { $template = locate_template( $_GET[‘template’] . ‘.php’, false ); } return $template; } add_filter( ‘single_template’, ‘wpa_single_template’ );

Is revealing just the AUTH_KEY a security issue?

Well, AUTH_KEY and it´s brothers where introduced in WordPress 2.6 to improve safety for logged in users. They are used to encrypt and validate the information in your backend login cookie. While revealing the AUTH_KEY alone might not be a real security issue, you should nevertheless not output/use this anywhere to give less surface for … Read more