• Hi Folks,

    I’m searching this forum and not getting anywhere. This plugin no longer functions as it should. The code is slightly sanitized to remove the name of my customer, but other than that, this is the plugin I’m using:

    An example URL would be https://customer.site.dev/acceptance/?req_info=ZZZZZ

    The req_info query_var is no longer passed to $wp_query->query_vars in the acceptance page.

    <?php
    /**
     * @package CUSTOMER Filters
     * @version 1.0
     */
    /*
    Plugin Name: CUSTOMER Filters
    Plugin URI: https://www.ieworks.net
    Description: Custom plugin to add URL filters to CUSTOMER web site
    Author: Darren Ellis
    Version: 1.0
    Author URI: https://www.ieworks.net
    */
    
    function customer_filters( $public_query_vars ) {
        $public_query_vars[] = 'req_info';
        return $public_query_vars;
    }
    
    add_filter('query_vars', 'customer_filters');
    ?>

    I think this broke when I upgraded to 4.4.2, but I didn’t test this after the upgrade, so I am not exactly sure when it broke.

    I’ve searched this forum and found lots of examples that would indicate that my code is good.

    I’ve tested on TwentyFifteen and gotten the same results: No req_info in query_vars.

    php56w-5.6.19-1.w7.x86_64
    nginx version: nginx/1.8.1

    Did something in 4.4* change the way plugins work?
    Did something in 4.4* change the way add_filter works?

    Anyway, I’d appreciate any assistance. Thanks so much!

    Darren

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The filter is fine as is. Using your code, the 'req_info'=>'ZZZZZ' shows up in the global $wp_query on a page in my installation. There was no substantive change in the way these things work. The problem lies elsewhere.

    Have you tried disabling all other plugins to ensure there is not some introduced conflict? It’s still possible a conflict was introduced with core code that affects something in your plugin. You’d need to trace through the query path to identify exactly where the query var disappears. Query Overview might help with this. Why it disappears should lead you directly to the conflict.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin to Add to query_vars Stopped Working’ is closed to new replies.