we've put a quick Drupal 6 site as part of a Give-Camp and at the last minute noticed a problem with the site blog's recent posts section. If you go here: http://closingthenolagap.org/ you can see the problem that I'm talking about under Recent Posts. Those links should exist since those posts do.
We can't figure out what setting we messed up that caused this functionality. Any help would be appreciated.
See this short screencast for a further demonstration of the problem: http://screencast.com/t/Zjc3MWMwMD
Looks like you might have removed some (all?) of the character replacement rules from the pathauto module (I assume you're using - if not we could do with more info on what modules you do have).
The paths to your blogpost have a lot of URL-encoded characters like %20 (which is a space) - pathauto should be replacing these automatically with dashes or underscores, or removing them.
Related
This is my first time using Ghost, and I installed the latest version for the first time yesterday.
I have a site which has links like:
site.com/2010/03/03/post-name
I tried to manually edit the URL when posting them, but it changed it to:
site.com/2010-03-03-post-name
I tried to look around and I found out that you can use /year/month/date on the URL, but that impacts all URLs. Not all of my old URL’s are on that format, but there are some of them which are very important in this case.
So my question is:
Is it possible to change the URL structure of SOME posts with the date, and some with default format?
I am tired of searching, and if I can’t find a way, I am just going to redirect the old URLs to the new ones.
Thank you in advance!
Do those posts need to live on those URLs? You can use custom collections to rewrite some posts depending on the tag they have applied, however I think it would be better if you went down the alternative route and redirecting those URLs to newer and more consistent ones. Ghost has a built in redirects feature which you can read up on here:
https://ghost.org/docs/api/v3/handlebars-themes/routing/redirects/
Problem
I need Wordpress to stop turning underscores into hyphens in its slugs/permalinks.
Situation
Moving an old site over to a clean Wordpress installation. Old site uses underscores in its urls. We need to preserve the old urls including underscores at this time (please do not recommend any SEO advice here, thank you).
Wordpress cleans up its slugs/permalinks. Underscores are turned into hyphens.
I want to be able to use both underscores AND hyphens in my slugs. I am not looking to replace one with the other completely, which is what most suggestions/solutions I've found boil down to.
Examples of a solution that does not meet my criteria:
https://wordpress.stackexchange.com/questions/78334/convert-hyphen-to-underscore-in-permalinks
Example of a solution to allow dots that may be useful:
https://wordpress.stackexchange.com/questions/231448/how-to-add-dot-in-post-slug
What I've tried
I have searched for a solution but was unable to find a satisfying one. Supposedly the cleaning up of slugs/permalinks is defined in /wp-includes/formatting.php using the sanitize_title_with_dashes function.
I pasted the code related to sanitizing here:
https://pastebin.com/jRqV8iB8
The only line I can see that targets underscores is:
$title = preg_replace( '/[^%a-z0-9 _-]/', '', $title );
For testing purposes I removed the underscore from that line, replaced formatting.php on the server and tried putting underscores in a slug again. But it didn't do anything. I also only just figured out based on the "allow dots in permalinks" link mentioned earlier, that that line supposedly ALLOWS underscores in urls.
This also fits the comment content "* Limits the output to alphanumeric characters, underscore (_) and dash (-)."
So... this code is saying that underscores are allowed (in slugs/permalinks?), but they're still being stripped in my slug/permalink.
Can anyone see something here that I cannot. Or suggest a filter that will allow both underscores and hyphens in the slug/permalink? Right now I'm stuck.
Thank you in advance for any help you're willing to offer.
Solution found
The Gutenberg editor forces hyphens in the slug of a post or page at this time: https://github.com/WordPress/gutenberg/issues/13091
In my case, I have enabled the Classic Editor plugin: https://wordpress.org/plugins/classic-editor/
I'll rebuild the website and the old urls with underscores that way. When I'm done I'll switch back to Gutenberg. The old urls will be changed carefully and gradually in the future and the new ones will use hyphens. So it should work out.
Alternatively, as user #admcfajn pointed out, you can modify the page/post slug from the page/post overview screen using the Quick edit functionality. Underscores added to the slug that way will stick, even with the Gutenberg editor active.
If you're looking to replace hyphens with underscores permanently, create a filter using the solution presented for this question instead:
https://wordpress.stackexchange.com/questions/78334/convert-hyphen-to-underscore-in-permalinks
Thanks to those who took the time to reply (one user deleted their reply or had it removed). I hope others will find this solution through Google in the future.
Hopefully either Gutenberg will be fixed or the comment in the formatting.php file will be amended to avoid confusion if it is the developers' intent to only allow users to use hyphens.
We shouldn't have any problem using both hyphens and dashes with WordPress
The url-slug of test_page-of-awesome is perfectly valid. So, I imagine there must be a setting somewhere in a plugin or theme which is rewriting or modifying those.
You mention that:
Wordpress cleans up its slugs/permalinks. Underscores are turned into hyphens.
... This is not expected behavior of WordPress and is being caused by a plugin, theme, or something else... But it is not how WordPress is expected to work.
Try the following:
enable a core-theme ( twentyninteteen, twentytwenty )
disabling all plugins
ensure that you're able to use pretty-permalinks wp-admin/wp-admin/options-permalink.php Settings >> Permalinks
& if you can't get url-slugs to save then the issue is likely coming from elsewhere on your server. Depending on the configuration of your web-hosting environment there may be something else affecting the url slugs. It might be apache mod_rewrite rules or something
I update my original post as well, but adding an accepted answer for visibility.
The Gutenberg editor forces hyphens in the slug of a post or page at this time: https://github.com/WordPress/gutenberg/issues/13091
In my case, I have enabled the Classic Editor plugin: https://wordpress.org/plugins/classic-editor/
I'll rebuild the website and the old urls with underscores that way. When I'm done I'll switch back to Gutenberg. The old urls will be changed carefully and gradually in the future and the new ones will use hyphens. So it should work out.
Alternatively, as user #admcfajn pointed out, you can modify the page/post slug from the page/post overview screen using the Quick edit functionality. Underscores added to the slug that way will stick, even with the Gutenberg editor active.
If you're looking to replace hyphens with underscores permanently, create a filter using the solution presented for this question instead: https://wordpress.stackexchange.com/questions/78334/convert-hyphen-to-underscore-in-permalinks
Thanks to those who took the time to reply (one user deleted their reply or had it removed). I hope others will find this solution through Google in the future.
Hopefully either Gutenberg will be fixed or the comment in the formatting.php file will be amended to avoid confusion if it is the developers' intent to only allow users to use hyphens.
I have added comment control module in my drupal site. It works fine by picking the bad words. But the issue is it is picking the word that has the same set.
Ex:It is picking "butt" as well as "butter" which i don't want to happen for butter.Is this a known issue for all or can it be fixed.
comments welcomed.
Thanks.
I'm having a bit of a major meltdown regarding a translation of a site. It's a wordpress site with a WooCommerce shop. LocoTranslate and Avada is installed.
The issue is, that some individual strings of text are not being translated - even when i've changed the .po file (with PoEdit).
For example, there's a string on the customer cart that says:
"hello USER (not USER? Sign out)"
In PoEdit it looks as such:
Hello %1$s (not %1$s? Sign out)
I'm adding a translation that says:
Hej %1$s (ikke %1$s? Log ud)
It's just not being updated on the site!
Does anyone know what I'm doing wrong??
There are 2 other words that won't be translated either :(
I work a lot with dual language WP sites and find this quite often. In most cases it dues to the textdomain being called before the strings in question are being called. In theory this shouldn't happen but it does. The solution that usually works for me is to add the textdomain a second time in yours functions file and use a hook that runs much later in the site loading process. This invariably fixes it although it a bit of a hack.
If this isn't working and you only need the site in one language you can create a child theme and manually translate the stubborn strings in the page template.
I have been looking around the web but could not find a solution to this problem. Right now the search function in Wordpress - as I understand it - goes through the posts and looks for matching words. That is fine, however I am working on a site right now where I wont have many posts / any posts. I will however have a lot of users - let's call them authors even though they won't be writing anything. I want the normal search to go through the author pages and display results based on what is written there.
Is this possible? I do understand a bit of code but mostly copy of tutorials.
Thank you so much in advance!
since you didn't provide any code attempts i will stick with a plugin solution..
try this
https://wordpress.org/plugins/amr-users/screenshots/