在 wordpress 的 get 方法中自定义 URL
Custom URL in get method for wordpress
我已经在我的主题主页中添加了这个表格
<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;}
?>
我在这里得到的 url 是
example.com/?name=google
我想要自定义 url 作为
example.com/name/google
那么我应该怎么做才能通过 get 方法获得自定义 URL?
将 Permalink 更改为 postname wp 自动转换
转到 wordpress 中的永久链接设置 wp-admin
。从那里,select 选项自定义类型或 post 根据您的要求类型。
我已经在我的主题主页中添加了这个表格
<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;}
?>
我在这里得到的 url 是
example.com/?name=google
我想要自定义 url 作为
example.com/name/google
那么我应该怎么做才能通过 get 方法获得自定义 URL?
将 Permalink 更改为 postname wp 自动转换
转到 wordpress 中的永久链接设置 wp-admin
。从那里,select 选项自定义类型或 post 根据您的要求类型。