setting up a new wordpress blog. slight problem and I've looked everywhere but cant seem to reference it. all over the net the usual syntax for select a specific category on wordpress sites is http://your.url/category/category_name/
for my site this syntax does not work. I get a page not found error. yet when i actually click on a category i have posted under it gives me a url like this http://www.your.url.co.uk/?cat=51
i can only assume 51 is the cat #
any ideas why the usualy doesnt seem to apply to my site. ps i have latest version installed
All the other sites you have seen this on are probably using category permalinks. Goto your dashboard and look under Settings->Permalinks. There is an optional area for building custom category URLs.
Go to settings-permalinks, and custom struckture, type in:
/%category%/%postname%/
Related
I've got an issue regarding categories I have never seen before.
I am able create a new category, and then everything is OK, the category is listed.
When updating a category in the WordPress admin, the category becomes unlisted. At postboxes, at the category admin page and with get_categories() as well.
However, the category is still viewable on the frontend, and I can access the category edit page when putting the right term ID in the URL (for example, I put 43 as ID in the browser omnibar.
wp-admin/term.php?taxonomy=category&tag_ID=43&post_type=post&wp_http_referer=%2Fwp-admin%2Fedit-tags.php%3Ftaxonomy%3Dcategory
I have searched the database but can't find anything. I searched the theme and can't find anything. I ran the WP_ALLOW_REPAIR database repair process, but no luck. The tool even says no repair was needed at all.
The site is running a theme from SMThemes and runs dual language with the WPML plugin.
Any thoughts?
The categories disappearing was caused by a bug in WPML version 2.7.1.
More information: [Resolved] Categories disappear after WPML activated
The troubleshooting options did not work for me, however. I decided to outcomment the add_filter terms_clauses in the sitepress.class.php file.
I have looked all over the place and can't figure out how to get this to work.
I want my urls for blog posts to look like this: "www.website.com/my-page/category-name/blog-post-title"
The issue I am having is that I have a page called "my-page".
So I have a page "www.website.com/my-page/" which is just a standard wordpress page, but I want the url for the blog post to look like it is under that page.
Here is what I have for the permalink so far:
/my-page/%category%/%postname%/
But this doesn't work and gets a 404 error when opening a blog post.
At this point I don't believe it can be fixed through the wordpress gui, so if anyone has any recommendations, it would be appreciated.
Thanks!
Edit: I wanted to add that the permalink works fine if I remove "/my-page" or if I simply modify it so it does not match the page.
First of all you should not use the category in front of your permalinks as it leads to bad performance (and some posts may have multiple categories): http://ottopress.com/2010/category-in-permalinks-considered-harmful/
The second thing is - it should work. I tried with a fresh installation on WordPress and I get the correct results.
Did you flush rewrite rules / save the new permalink structure?
Did you publish a post?
Is your server correctly configured to use permalinks?
Third possibility - if your permalink structure does not work for some reason you can define a custom permalink structure:
https://codex.wordpress.org/Rewrite_API
I did a great amount of research and came across some solutions like this:
https://wordpress.stackexchange.com/questions/106042/force-wordpress-to-show-pages-instead-of-category
But still it isn't exactly what I'm looking for. First of all let me explain the problem.
I made a page /blog/ and a category 'blog' both make use of the permalink /blog/, disabled the /category/ permalink so the SEO will be correct.
The solutions I came across didn't match the following requirements:
Not using 301 redirects
Disable the /category/ use within Wordpress.
Also make it possible to only replace category when a page id uses the same slug.
I simply like to tell Wordpress to display the page instead of the category.
Why don't you just edit the category template?
Because the page I created uses Visual Composer (Post Masonry Grid) so I can't simple move the design.
Why don't you just use redirects?
I would like to but the permalink of the blog is the same as the page (SEO purpose.)
I know it's a few years later with no solution, but I had the exact same problem you described on one site that was working in other sites. So I did some research on what was different and to help others should they run into the same issue.
Background
example.com is the domain
I have a WP page called "foobar" with content
I have a WP post category called "foobar"
I have a WP post entitled "fun things to do with foobars", and the category is set to "foobar"
Expectations
When I go to example.com/foobar, I want to see the page about foobars, not a WP category page that shows all blog posts with that category.
When I go to the blog post about fun things, the URL is example.com/foobar/fun-things-to-do-with-foobars/
Setup
Here's my setup (it does not require any additional plugins or code edits)
A couple of installed plugins are WP Rocket and Yoast on which I'll focus in this thread.
WP Dashboard->Settings->Permalinks
Select "Custom Structure" and enter /%category%/%postname%/ in the field
On the same page, change "Category base" to a single dot. "." (no quotes, just a single dot/period/full stop
I have Yoast installed, which I had set up to override the permalink settings, but I believe this messed up my task at hand.
WP Dashboard->SEO->Advanced->Permalinks(tab)
"Change URLs->Strip the category base..." = Keep
Then you need to clear the cache. I use WP Rocket for caching, so I flushed the cache and everything now works the way it should.
Edit: make sure you save your changes after steps 3 and 5
I know this topic is old but question is still important.
I will use blog example.
This method is code free, WP native solution. One caveat is that you cannot translate "blog" slug, so this method is only for one language if you don't need to have different words/slugs for other languages.
Create page with slug "blog". Or whatever you like. It must match word you put in next step as base: blog = blog it this example.
Set permalink structure in settings to: /blog/%category/%postname%/ (/ trailing slash on the end is your preference)
Use SEO plugin like Yoast or Seopress Pro (or any other
method) to remove /category from URL.
Go to Settings -> Reading -> "Your homepage displays" section -> "A static page (select below)"
Set your static page for Homepage
Here is the magic: set Posts page to your "Blog" page.
Flush permalinks by visiting and saving settings on Permalink page (without any change).
Then you will get proper URL: /blog/yourcategory/single-post-title/
Breadcrumbs will work, all categories will be hierarchical, and /blog will work as page instead of category.
Most importantly, when you go to your category page you will get /blog/yourcategory URL and it will work as archive page. When you visit single post, then also you get URL /blog/yourcategory/single-post-title/
Breadcrumbs from Yoast should work. I use Seopress Pro and breadcrumbs works like a charm (you have to go to breadcrumbs setting page and select categories for posts and posts for categories and tags if you need them).
If you do it without including /blog in your permalink setting it will still work, you will get page instead of category with proper url for categories, but single post will be /yourcategory/single-post-title.
I'm working on rebuilding a friends website however cannot get the wordpress comments to show up on posts, I have tried disabling all plugins, switching themes (even default themes) but the comments still do not show up.
This is the first time I've worked on a wordpress site and all the posts I can see from people with the same issue resolved it either by disabling plugins or switching themes (usually issues with single.php which the theme I'm using does not have that file).
Any ideas?
URL for the site
Looks like there are no comments on that site, the "Comments feed" is empty: http://happybody.co.nz/comments/feed/
Have you checked SETTINGS > DISCUSSIONS > Allow people to post comments on new articles - or any of the other Comments Settings there?
In the file sigle-post.php or like some Think similar in the theme folder, find the function get_post_commets($post->ID) and delete.
May be exist an foreach to show a result of the function one by one.
Get lucky.
Find get_post_comments() function ... In wordpress site support.
So I've just figured out why the comments section does not show up, when I recreated all the posts from a cached copy of the site from archive.org/web I never ticked the box on each post under "discussion" for "allow comments".
I am working on making urls like example.com/profile/username to work where example.com runs Wordpress(latest release). The install is on root. I wrote a plugin hook to catch template_redirect and I examine the URL to see if it is a profile request and then I show the profile.
But, when a URL that does not exist is typed, Wordpress does an auto search for related posts before triggering a 404 or template redirect.
For example, example.com/profile/foobar goes to another page which has foobar in its title like example.com/2009/10/1/foobar
How do I stop this from happening?
I haven't upgraded my wordpress blog in probably 2 years (posts or software), but my first thought was a .htaccess file. I looked at the main one and found:
But that doesn't explain search results right off. So I found this file
/wp-includes/rewrite.php
which has a few dealings with permalinks and search results. The main one I spotted was:
// Search
$search_structure = $this->get_search_permastruct();
$search_rewrite = $this->generate_rewrite_rules($search_structure, EP_SEARCH);
$search_rewrite = apply_filters('search_rewrite_rules', $search_rewrite);
Basically, if all searches are turned into permalinks and all permalinks are rewritten to a script that creates a generic page, you get the /foobar page...
I'll keep you posted on what I find.