Create WordPress posts with links under /blog - wordpress

My current set-up results in posts being created under the webroot:
www.domain.com/my-post
www.domain.com/my-other-post
How can I make it so posts are created "under" /blog/:
www.domain.com/blog/my-post
www.domain.com/blog/my-other/post
Editing the permalink results in the / needed being turned into a -.
Is there a setting the force posts under a parent?

Use https://wordpress.org/plugins/custom-permalinks/ plugin and just add blog in url before post name,it will work

As at WordPress 5.2.2, in Settings > Permalinks, in the Common Settings section, the option to set a custom structure for permalinks exists for posts.
The default is set to Plain, which results in /?p=123 style posts. Switching to Custom Structure allows the switch from the default of /%postname% to /blog/%postname%.
My existing posts now live under /blog/ along with newly created ones.
As a side note, if the site is already live then redirects might be needed if you have post links out in the wild.

Related

How do I find the parent URL on a webpage (Wordpress)

I am working on a website for a company right now and I am running into this issue:
The original URL is similar to this: mysite.com/industrial/ where industrial has 4 subcategories which each have 2-6 pages within them. I changed the original URL to mysite.com/products/ but the subcategories and pages within are not changing to include products in their URL - they still use industrial.
For ex.: mysite.com/industrial/abc/ should be mysite.com/products/abc/ but it stays as mysite.com/industrial/abc/ after I made my change.
I assume that the subcategories are in a folder called industrial (I did not create this website so I do not know), however I can't find that folder anywhere and I'm not sure where to look. I have tried to go in to each of the subcategories and change their URLs, but I can only edit the abc part of the URL and I can't touch the rest.
** This was all done on Wordpress with a custom theme created by another company. Thank you in advance for any help you can offer!
EDIT: For anyone who is also struggling this problem this is how I solved it:
Go to Plugins -> Plugin Editor
At the top there was an option called "Select plugin to edit" -> chose the one that is custom to your website
I found the information that was suggested by Phil in the comment section on this website
I updated the names of my fields in the rewrite permastruct section for register_post_type as well as register_taxonomy
Update the page and flush your permalinks and you should be good to go!
Check what is the defined slug when registering the custom post type.
Whenever a new Custom Post is added through a plugin or them, then the permalinks needs to be flushed.
In the WordPress admin area, go to “Settings > Permalinks”. Click “Save Changes”. The permalinks and rewrite rules are now flushed.

Postname permalinks not working – all pages send to homepage

I have WordPress installed in a subfolder of my domain. I want to keep it there, so that it is accessible only through http://www.example.com/mywordpress.
I have an issue with permalinks. If I use postname permalinks, all my pages (with different templates applied) redirect to the homepage, while my archives (including custom post type archives and singles) are displaying correctly. If I use custom structure permalinks and I prepend anything to the postname – for example /test/%postname%/ – all pages display correctly while custom post type archives and singles display a 404 error.
This happens whenever I refresh permalinks and also after replacing .htaccess with one from a brand new WP install.
The odd thing is also how the permalinks are displaying in the browser url field:
if I use /%postname%/
pages (not working) display as
http://www.example.com/mywordpress/postname – they all display the
homepage contents
CPT archives+singles (working) display as
http://www.example.com/mywordpress/postname
if I use /test/%postname%/
pages (working) display as
http://www.example.com/mywordpress/postname – so without the
prepended text!
CPT archives+singles (not working) display as
http://www.example.com/mywordpress/test/postname – displaying a 404
error
My custom post types have slugs translated to different languages with WPML. I thought that might cause the issue, however I tried to deactivate all plugins included WPML and still no luck.
Does anyone know what might cause that?
I figured it out. I was using reserved terms as custom taxonomy slugs (https://codex.wordpress.org/Reserved_Terms). By changing them to something else everything started working normally again!

How to remove the /category/ from the URL in Wordpress?

So, I have a website for news and I have the following:
www.mywebsite.com/category/football
www.mywebsite.com/category/basketball
www.mywebsite.com/category/tennis
Etc... how can I remove /category/ from these, so it only works with /football dir.
Any help is appreciated.
Easiest thing to do is use a plugin and not .htaccess rewrite rules or changes to the permalink settings in WP admin. The plugins below will remove the category base for category archive pages as well as single posts. The category or tag base will revert to normal when the plugins are deactivated without post 404's.
See http://wordpress.org/plugins/wp-no-category-base/ and, if needed, http://wordpress.org/plugins/wp-no-tag-base/
http:/yourblog.com/category/quotes/
If you want to remove /category/ from the url, follow these two steps:
Go to Settings >> Permalinks and select Custom and enter: /%category%/%postname%/
Next set your Category Base to /.
Save it and you’ll see your URL changed to this format:
http:/yourblog.com/quotes/
Taken from http://premium.wpmudev.org/blog/daily-tip-quick-trick-to-remove-category-from-wordpress-url/

Wordpress 3.4.2 custom permalinks for Posts, Archives, and Categories only

We have a custom WordPress theme running on WordPress 3.4.2 and are running into some problems with our Permalink settings and a particular calendar plugin we're using on our website. Our website is somewhat non-traditional in the sense that all of our Posts are located within a section of the website called /news-events/ (e.g. www.domain.com/news-events/).
Currently, we are using the following custom permalink structure: /news-events/%year%/%monthnum%/%postname%/ to match the location of our Posts. We have created about 30 websites from this template using this permalink format without any issues.
However, the calendar plugin (The Events Calendar Pro 2.0.10) we're using on this particular site requires the Permalink structure to be /%postname%/. When the permalink structure is set to anything other than /%postname%/, any calendar events pages return 404 pages. Unfortunately, setting our Permalink structure to /%postname%/ is not a viable option for us as it's imperative for us to keep the /news-events/%year%/%monthnum%/%postname%/.
The Question:
Is it possible to set the overall WordPress Permalinks to /%postname%/ while customizing the Permalink structure for Posts, Archives, and Categories to /news-events/%year%/%monthnum%/%postname%/? Put another way: how can we change the Permalink structure to /news-events/%year%/%monthnum%/%postname%/ ONLY when a Post, Category, or Archive is being viewed?
The following pages provided some useful information, however, it seems we'd need to do the opposite of what's described:
http://shibashake.com/wordpress-theme/custom-post-type-permalinks
http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-2
Any and all help is greatly appreciated.
Can you set the permalink structure to %postname%/news-events/%year%/%monthnum% ?
It may possible allow the plugin to grab the first part of the request (Being postname)

How to Change the permalink of new posts while keeping the existing permalink for existing posts in wordpress

I want to change the permalink of new posts while keeping the existing permalink for all old posts for a wordpress based blog in order to retain the backlink power and social sharing score. I have searched the whole wordpress plugin directory and found only one plugin called Advanced Permalinks. I tried this plugin but couldn't get the required resutls. It gives 404 error for all previous posts.
Could you any body help me in this regard?
you must set default setting at the beginning and put page id and post id like ?page_id or ?p on the page or post then change the permalink option from setting. Wordpress change permalink at run time from default setting.

Resources