AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

Filter by custom fields

Topic prefix

AI Assistant
Notifications
Clear all

[Closed] How can permanently use the topic id for slug

15 Posts
3 Users
1 Reactions
1,564 Views
Posts: 28
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@kilany)
Eminent Member
Joined: 5 years ago
[#24966]

Hi there 

 

I am sking about how can permanently use the topic id for slug ?

 

Becasue I see some post saying will add this https://wpforo.com/community/how-to-and-troubleshooting-2/how-to-use-post-ids-in-url-instead-of-title-slug/paged/2/


14 Replies
adisaputro
Posts: 130
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@adisaputro)
Estimable Member
Joined: 7 years ago

AFAIK, we can't using topic id as permanent slug, only for short link.


Robert
Posts: 10716
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

@kilany,

I'm sorry, but there is no way to use ID based URLs in forum. It's only available as a quick link. We're not planning to add it in the near future.


Posts: 28
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@kilany)
Eminent Member
Joined: 5 years ago

I can do this from database why you do not give to us this options ? Every time I do this manually to change for every new topics on phpmyadmin.

 

Posted by: @robert

We're not planning to add it in the near future.

You should give us the freedom to use whatever we want because it is really annoying when the name is long and inconsistent with other languages while in English there is no problem

 


1 Reply
adisaputro
(@adisaputro)
Joined: 7 years ago

Estimable Member
Posts: 130
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@kilany I agree with you


Robert
Posts: 10716
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

@kilany,

You can set the topic ID as the topic slug using hook code.

Put this code in a PHP snippet using Code Snippets plugin or in the functions.php file of your current active WordPress theme:

add_filter('wpforo_add_topic_data_filter', function( $args ){
if( wpfval($args, 'slug') ){
$topicid = WPF()->db->get_var("SELECT MAX(`topicid`) as topicid FROM `" . esc_sql( WPF()->tables->topics ) . "`");
if( $topicid ){
$args['slug'] = (string) ( intval($topicid) + 1 );
}
}
return $args;
}, 10);

9 Replies
(@kilany)
Joined: 5 years ago

Eminent Member
Posts: 28
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert

Thank you very much. It works. I really appreciate this 😍 

Is there a way to shorten the name of the forum, for example?

example.com/forum/experience/1

domain / forumname / subforum / postID

The name of the forum and the name of the section, can I make them abbreviated to be for example with out the subforum

example.com/forum/1


Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10716
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Posted by: @kilany

The name of the forum and the name of the section, can I make them abbreviated to be for example with out the subforum

I'm sorry, but there is no way to do a structural change in URL.


(@kilany)
Joined: 5 years ago

Eminent Member
Posts: 28
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert I create two posts they give same post ID on browser but on Database is okay it's have ID for each, So I mean it's make same slug for each creating post

 

 

 slug

Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10716
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@kilany,,

I've just updated the code, please copy again and replace the old one in your website.


(@kilany)
Joined: 5 years ago

Eminent Member
Posts: 28
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert its still same number slug fixed on number 2


Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10716
Robert
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@kilany,

That's just impossible. Are you testing on a live website? The code has been tested on 5 different hostings and on localhost, it works fine. Please make sure you've copied and pasted the source code correctly, leave some screenshots.


(@kilany)
Joined: 5 years ago

Eminent Member
Posts: 28
Robert
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert I am using Cloudflare so I wanna check it


(@kilany)
Joined: 5 years ago

Eminent Member
Posts: 28
Robert
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@robert I test it on another WP that still slug fixed number


Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10716
Robert
Robert
Robert
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@kilany,

Something wrong with your database setup. It seems your WordPress doesn't have access to MySQL's information_schema.tables. This is an unusual issue.

In any case, I just updated the script. It should work in your case as well. Please delete the previous script. Again, make sure it's deleted, then copy and use the new script.


Share: