skip to Main Content

I had add this form in homepage of my theme

<form action="" method="GET">
    <label>NAME:</label>
    <input type="text" name="name" id="name" required/>
    <button>GET</button>
</form>

<?php

 if (isset($_GET['name'])){

    $name = $_GET['name'];

  echo "hello".$name;}
?>

and here I am getting url at top is

example.com/?name=google

and i want custom url as

example.com/name/google

so what should i do to get custom URL by get method?

2

Answers


  1. Change Permalink to postname wp automatically convert it

    Login or Signup to reply.
  2. Go to Permalink settings in wordpress wp-admin. From there, select the option custom type or post type according to your requirements.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search