top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to add more slugs to one permalink in Wordpress?

+1 vote
408 views

I want my permalink to be accessable via more than one slug.

For example:
example-page.com/contact/1234 or example-page.com/contact-1234

posted May 12, 2017 by Sahana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In WordPress, the term slug is used for the url friendly name of a post, page, tag, or category. It is automatically generated by WordPress and used in URL when you create a new item.
For example, a post titled “20 Most Amazing Coffee Shops in Manhattan”, WordPress would generate a post slug like this 20-most-amazing-coffee-shops-in-manhattan. Depending on what permalink structure you have, your post URL will look something like this:
http://example.com/2016/02/20-most-amazing-coffee-shops-in-manhattan/
Same thing happens for your pages, custom post types, tags, categories, custom taxonomies, etc.
Now if you just want to change that slug part of the permalink, then that’s easy. You can do that without installing any plugins or writing any code.

In WordPress, the term slug is used for the url friendly name of a post, page, tag, or category. It is automatically generated by WordPress and used in URL when you create a new item.

answer May 18, 2017 by Ankana Guchait
Similar Questions
0 votes

I need to add a variable inside an array of an embedding gravity forms to populate 2 hidden fields: email and jobname.

Here is my code:

<?php 

    $email = get_field( "email_application" );
    $jobtitle = get_the_title();

    gravity_form( 5, false, false, false, array('email'=>'echo "$email";','jobname'=>'print "$jobtitle";'), false); 
?>

I know that echo, print or just the variable doesn't work as it show like this in my code:

<input name="input_6" id="input_5_6" type="hidden" value="print $jobtitle" class="gform_hidden" aria-invalid="false">

and

<input name="input_5" id="input_5_5" type="hidden" value="echo "$email";" class="gform_hidden" aria-invalid="false">

Instead I should get:

<input name="input_6" id="input_5_6" type="hidden" value="My job title" class="gform_hidden" aria-invalid="false">

and

<input name="input_5" id="input_5_5" type="hidden" value="myaddress@email.com" class="gform_hidden" aria-invalid="false">

Can someone could point me in the right direction.

Thank you.

0 votes

I have Wordpress site and I have incorporated Disqus into my posts but I am not sure how to add them to my pages. Any help will appreciated?

0 votes

I building a website on Wordpress. When I add this below code

$(document).ready(function() {  
$('#readerareaimg img').each(function(){
var filename = $img.attr('src')
$img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
$img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
});  

My website will generate alt and title tags automatically on images based on their file name, but I want to add any word or text before the file name. For example file name is phoneimg.jpg and it will display alt="phoneimg", but I want that alt to become alt="read phoneimg". How can I do this?

0 votes

I am developing a wordpress portal. I am sending html content(youtube iframe) with ajax from frontend pages. But while I am inserting that post wp_insert_post removes iframe codes in it. There is no problem with ajax or somewhere else. I guess there is somekind of filter. How can I disable that and insert iframe code?

Code before inserting -> $_POST["content"]

<div class="line nVideo" style="text-align: center;" ><iframe id="player" type="text/html" width="650px" height="380px" src="http://www.youtube.com/embed/mY8BZsIgg74?showinfo=1&amp;enablejsapi=1&amp;color=white&amp;origin=http://432designstudio.com" frameborder="0" allowfullscreen=""></iframe></div><div id="empty-line" class="nText " ><div>gasdgdsag</div>

And after insertation i call content again -> get_post_field('post_content', $postID)

<div class="line nVideo" style="text-align: center"></div><div id="empty-line" class="nText "><div>gasdgdsag</div>
0 votes

I am making a custom plugin for wordpress and i need to create a page in the admin menu. I already have a file called menu_list.php with the following code:

function jps_mail_list_page_entry() {
add_menu_page(
    __('JPS Mailing List'),
    'JPS Mailing List',
    'manage_options',
    'jpsNews_mailinglist',
    'jpsNews_mailing_list',
    'dashicons-email'
);
}
add_action('admin_menu', 'jps_mail_list_page_entry');

function jpsNews_mailing_list() {
    echo 'hello';
}

Now, in the plugin page i have this:

function jpsNews_activate_plugin() {
    include_once(plugin_dir_path(__FILE__).'pages/mailing-list.php');
}
register_activation_hook(__FILE__,'jpsNews_activate_plugin');

Its not working. How can i do it?

...