Support » Plugin: Maintenance Redirect » Redirect to a WP-page?

  • Resolved najram

    (@najram)


    Hello there,

    I really like your plugin. It’s simple and straightforward.

    The mentioned one is the only additional feature (in my opinion), that would be really nice to have.
    This way one could create advanced offline page within WP, using G. blocks or whatever page builder he likes.

    I’d tried to add some WP content (contact form) with shortcode, using do_shortcode() function, to the php page I’ve created and loaded to the root directory, but it obviously didn’t worked…

    So, is there a chance to find the redirect to a specific wp-page option in some future release?

    Cheers 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Rob Snijders

    (@robsnijdersletigrenl)

    I like to have this functionallity aswell.

    Plugin Author Peter Hardy-vanDoorn

    (@petervandoorn)

    Hi @najram & @robsnijdersletigrenl (and apologies to @najram for not replying sooner – for some reason I don’t always receive notifications from wordpress.org about new posts – I only saw this because of Rob’s comment!!)

    Unfortunately, what you’re asking for isn’t possible as the redirect checks happen too early in the WordPress activation sequence – it actually happens before WP sets up the post data, so it’s not possible to use the built-in conditionals to check what page or post we’re on.

    However, there is as workaround to give you what you want as you can use the wpjf3_matches filter to check the URL of the page and allow access that way, for example:

    function my_wpjf3_matches( $wpjf3_matches ) {
        $slug = 'contact-us'; // <- add the page slug here
        if ( stristr( $_SERVER['REQUEST_URI'], $slug ) ) 
            $wpjf3_matches[] = "<!-- Contact us page -->";
        return $wpjf3_matches;
    }
    add_filter( "wpjf3_matches", "my_wpjf3_matches" );

    So, with that in your theme’s (child theme or self-coded, of course) functions.php file you could then set the redirect type to “Redirect – a little harder” and add the complete URL of your Contact Us page.

    Hope that helps

    Peter

    Thread Starter najram

    (@najram)

    Hi Peter,

    apologies also from my side for a delayed response.

    Anyway, I’ve tried you code snippet and it works like a charm. Actually, it is exactly what I needed. 🙂

    Thank you!
    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.