Support » Fixing WordPress » Custom Permalinks

  • Hello everyone, I hope you can help me. For my site, for user pages I would like a permalink that also includes the user’s phone number. The theme I am using is Listeo. The phone number is already an element in the theme itself, but I would like to include it also in the url for each registered user.

    How can I do this?

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @valeriasov

    Try Custom Permalinks plugin for the same. Thanks

    Thread Starter valeriasov


    I know the plugin, but perhaps it is not suitable for my purpose, because it modifies every single page. I would need it to be automatic, as the value I am interested in coming up on the url is the user’s phone number, i.e. a value that is already requested from the user.
    I would need it to change the structure of permalinks in general, as if it were another value added to the available tags. I would need, for example: %tel.number%

    Unfortunately, I do not have access to my PC during the weekend and I am not familiar with Listeo plugin, so I am not able to provide you with a tailored solution.

    If you know PHP and WordPress API you can use the below code snippet as an example. It adds a new permastructure tag (%username%) that allows to get the name of the post’s author. The phone number is probably stored as an author meta and if so you can get it using get_user_meta() function:

    function pm_support_username_tag($default_uri, $native_slug, $post, $slug, $native_uri) {
        $author_name = sprintf("%s-%s",
            substr(get_the_author_meta('first_name', $post->post_author), 0, 1),
            get_the_author_meta('last_name', $post->post_author)
        $default_uri = str_replace('%username%', sanitize_title($author_name), $default_uri);
        return $default_uri;
    add_filter('permalink_manager_filter_default_post_uri', 'pm_support_username_tag', 10, 5);
    Thread Starter valeriasov


    Unfortunately, I do not know PHP. It is very important for me to be able to do this. If you can and especially want to, even next week you can have a look at the theme, I will link to the test page, as you can see in the details a phone number appears. The user in the registration phase put that number, I would really like to put it in the url of his page.

    Thread Starter valeriasov


    I will try to be clearer, maybe you can help a non-expert like me.
    In short, the theme in question allows registered users to publish their own ad. To do so they have to fill in a form, which by the way already requires a phone number by default. The phone number variable already exists? Is that correct? Also, could I add this variable in the permalink settings of the listings?
    I have tried adding %phone% but it is not recognised.
    I don’t know, can someone kindly help me? The problem is that I can’t find the variable in php that corresponds to “phone”.

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