• Resolved Brian Henry

    (@brianhenryie)


    Hi,

    A plugin I use has a REST API which isn’t under /wp-json/ so I need to exclude its URL from redirecting.

    Currently I’m editing the plugin but it’s getting overwritten with updates.

    } elseif (stristr($_SERVER['REQUEST_URI'], 'pnfw/register') ) {
     $wpjf3_matches[] = "<!-- WPJF_MR: pnfw/register -->";

    Could you either add a filter, changing line 153 to:

    $wpjf3_matches = apply_filters( 'wpjf3_matches', array() );

    which would allow me to add_filter in my functions.php,

    or maybe add an option in the settings where I could specify a regex to match.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Peter Hardy-vanDoorn

    (@petervandoorn)

    Hi @brianhenryie

    I like your idea very much.

    I must admit that this is a part of the code that I haven’t looked at since taking it over from the original developer so, if you would be so kind to give me an example of how such a filter would work, then I shall implement forthwith!

    Cheers
    Peter

    Thread Starter Brian Henry

    (@brianhenryie)

    Line 231 if( count( $wpjf3_matches ) == 0 ) { checks has any reason been given NOT to process redirect. The plugin’s existing reasons are checked earlier in that function and added to the wpjf3_matches array e.g. $wpjf3_matches[] = "<!-- WPJF_MR: IP MATCH -->";. It doesn’t seem the reasons are passed anywhere else to be used, but adding anything to the array would stop the redirect from happening. If you change line 153 to $wpjf3_matches = apply_filters( 'wpjf3_matches', array() ); it won’t affect the running of the existing code unless a filter is added by another plugin or in the user’s functions.php.

    • This reply was modified 5 years, 6 months ago by Brian Henry.
    Plugin Author Peter Hardy-vanDoorn

    (@petervandoorn)

    Hi @brianhenryie

    I’ve just uploaded version 1.6 with your idea implemented exactly as you suggested.

    Thanks for the input, and sorry it took me longer to get around to it that I’d hoped ??

    Cheers
    Peter

    Thread Starter Brian Henry

    (@brianhenryie)

    Thanks. Here’s how I’m using it:

    https://gist.github.com/BrianHenryIE/520724d8bc69aa058c1af89e16e8bf51

    It redirects visitors only when they are in the USA, and not requests to the push-notifications-for-wordpress endpoint.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude URLs’ is closed to new replies.