wordpress

  • WooCommerce 2.6 shipping zones replaced the flat table

    Shipping used to be a global list of methods each carrying its own availability rules, which meant every method had to know about every country. 2.6 inverted it:…

  • no_found_rows removes a COUNT query you are not using

    Every WP_Query runs a second query to count the total number of matching rows, so that pagination can be rendered. If the query is powering a sidebar widget…

  • wp-config constants worth setting on every install

    A default wp-config.php leaves the file editor enabled, revisions unlimited and debugging output aimed at the browser. Four constants close most of that, and they belong in the…

  • get_posts suppresses filters and WP_Query does not

    get_posts() is a thin wrapper over WP_Query, so they are usually described as interchangeable. They are not: get_posts() defaults suppress_filters to true, which disables every posts_* filter for…

  • sanitize_text_field on input, esc_html on output

    The two families are constantly swapped because both “clean up a string”. Sanitising decides what is allowed to be stored; escaping decides how it is rendered safely in…

  • add_image_size does nothing to images already uploaded

    add_image_size() registers a size that WordPress will generate at upload time. Adding one to a theme has no effect on the several thousand images already in the library,…

  • WP-Cron only runs when someone visits

    WP-Cron is not cron. It is a check performed on page load: if a scheduled task is overdue, WordPress fires a loopback request to run it. On a…

  • Filtering a WooCommerce catalogue without the meta tables

    Five filters over 30,000 variations, and a request that never returns. Replacing EAV meta joins with a denormalised index table kept in sync by product hooks.

  • WP_Query fields => ids when you only need the IDs

    A normal WP_Query hydrates every result into a WP_Post object and primes the meta and term caches for all of them. When the only thing you want is…

  • pre_get_posts is the hook query_posts pretends to be

    query_posts() replaces the main query after WordPress has already run it, which throws away the first result set, breaks pagination and leaves conditional tags lying about what page…