orderby property of query on pre_get_posts returns incorrect value
As Tom J Nowell pointed out in the comments, I was targeting the wrong hook for this. Correct hook to modify the WP_User_Query is pre_get_users.
As Tom J Nowell pointed out in the comments, I was targeting the wrong hook for this. Correct hook to modify the WP_User_Query is pre_get_users.
A 404 is the expected behaviour. You’ll find no link to such a URL in the WordPress admin, there’s no functions to generate that URL in code, and there is no possible template for such an archive, as shown in the Template Hierarchy documentation (archive-movie-genres.php is not a valid template). The path /movie-genres alone will … Read more
The code you shared is for an action/filter named pre_get_posts. WordPress will run this action before it uses the arguments for WP_Query objects to generate SQL. It is an opportunity for you to modify that queries arguments/parameters. By doing this it will call all the functions attached to that action/filter/event. Is this variable a default … Read more
The examples you’ve seen are out of date. From WordPress 4.5, released in 2016, the proper way to support a custom logo was to register support for the Custom Logo feature in your theme. That link has the full documentation, but the short version is that you use this code to enable the standard logo … Read more
I figured this out while writing the question, but I thought I’d post it anyway since I couldn’t find the answer to this on Google. It turns out I had deleted a page at some point, but I had a menu item that still pointed to that deleted page. That menu item caused all these … Read more
You won’t be able to replace it at all if the plugin is not checking whether the constant has already been defined using if ( defined( ‘MAX_THINGS’ ) ). By definition constants can’t be overwritten, so this check is necessary to make a value ‘pluggable’. Adding @ to define() will suppress the error but it … Read more
You can’t. You can only mitigate at expense to yourself. People determined to do this will achieve their goal regardless of how many obstacles you place in their path The GPL means you can’t control how people use the code once you put it in their hands, and you can’t prevent them modifying it Nothing … Read more
For Case 1: Building from scratch First you need to create the Theme Stylesheet called style.css for registering the theme. Then create the index.php file form your raw HTML index file. After that break down the index.php into header.php, index.php and foter.php to create the primary scaffolding for your theme. Then create functions.php archive.php page.php … Read more
Difficult to say how to implement it exactly without looking at your code. But the idea is to use the $wp_query->current_post variable that is always available in the main query. It would look something like this: <?php if ( have_posts() ) { while ( have_posts() ) { the_post(); global $wp_query; if ( $wp_query->current_post === 0 … Read more
Using hooks is what plugin is supposed to do. Using hooks ensures that core files are not changed. Woo theme files from the theme are based on the core Woo files from WooCommerce plugin, so they share same hooks. And that is the way it should work. Also, you can’t include files from theme into … Read more