Correct way to add Querystring to URL in WordPress | add_query_arg | WordPress Tips and Tricks

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 22

  • @BuntyWP
    @BuntyWP  3 года назад

    Thanks for watching! Don't forget to subscribe and follow me on Twitter and Instagram. Links are in the description.

  • @tochukwuokafor1251
    @tochukwuokafor1251 Год назад

    Good day sir please do you have tutorial for lms to show student, instructor and admin and it's features without the use of plugins

  • @leonardchamin
    @leonardchamin 3 года назад +1

    bro. how do you redirect to page using this command

    • @BuntyWP
      @BuntyWP  3 года назад

      Use this function to redirect developer.wordpress.org/reference/functions/wp_redirect/

  • @tochukwuokafor1251
    @tochukwuokafor1251 Год назад

    Good day sir please how can I pass query parameter in wp_logout_url().
    This what I want to achieve
    localhost/WordPress/wp-login.php?action=logout&_wpnonce=243b04g7ee&user_id=1
    Even when the link is hovered it should not show the custom logout url which is
    localhost/WordPress/wp-login.php?action=logout&_wpnonce=243b04g7ee
    Please how can I achieve that

    • @BuntyWP
      @BuntyWP  Год назад

      assign wp_logout_url() to a variable and then pass arguments in an array format which you want to pass as query string as shown in this video at 05:00 timestamp > ruclips.net/video/8_TEsnP8Bjc/видео.html

    • @tochukwuokafor1251
      @tochukwuokafor1251 Год назад

      @@BuntyWP this my functions.php
      add_action('init', function ()
      {
      if ($_GET['action']='logout') {
      $current_user = wp_get_current_user();
      $wp_logout_url = wp_logout_url();
      $new_url = add_query_arg('gide', $current_user->ID, $wp_logout_url);
      return $new_url;
      }
      });
      after refreshing the page when and i inspect the page it showing
      Log Out

    • @tochukwuokafor1251
      @tochukwuokafor1251 Год назад

      i would like it to look like this
      Log Out

    • @BuntyWP
      @BuntyWP  Год назад

      @@tochukwuokafor1251 So above solution didn't work?
      OR may be I couldn't understand your query properly.
      by add_query_args you can add as may query strings as you want to any url.

    • @tochukwuokafor1251
      @tochukwuokafor1251 Год назад

      @@BuntyWP yes I didn't work