• Hi All,

    I have just got my WordPress site going, and am finding that some permalinks are being return incorrectly. It seems to be returning:

    /%category%/%postname%/https://www.domain.com/cars/ford/

    where obviously I would just want

    https://www.domain.com/cars/ford/

    Does anyone know why it is adding the permalink code on the front of the link?

Viewing 5 replies - 1 through 5 (of 5 total)
  • As admin, if you go to Options – General Options, what do you have set in the two URI fields? And do they have the “https://” in front?

    Thread Starter r2d2_r2d2

    (@r2d2_r2d2)

    They do indeed, yes.

    I have this for both:

    https://www.domain.com

    I don’t have a Star Wars nick, but I might be able to help.

    If what you want is https://www.domain.com/cars/ford/, is the category ‘cars’ and the post ‘ford’? or is the category ford?

    I presume you went to Permalinks under the options menu wp-admin/options-permalink.php
    And if you wanted a simple /%category%/%postname%/ structure, you entered that in the custom structure. If you wanted the category to be ‘ford’, and everything would be listed under cars, you could just set the basename as /cars in the optional field below.

    If what you’re saying is you’ve set that and all the links return without interpreting %category% as cars, for instance, then somehow you’ve really buggered the WP code and I’d be curious what you may have edited. Try setting different options (such as the default for permalinks) and report what happens. A live link would help.

    Thread Starter r2d2_r2d2

    (@r2d2_r2d2)

    ??

    In my case the category is ‘cars’ and the posts slug is ‘ford’.

    I have ‘/%category%/%postname%/’ in the permalink option, and nothing in the one below it.

    The page it is happening is here: https://www.housebuyingguide.co.uk/ The two posts I have got are just under the picture. You can see that the main title link, and the comment link have this problem, but the ‘posted in’ links work fine. (Though these seem to be of the form /category/cars/ford/’ – i.e. have the virtual folder ‘category’.)

    It is possible I have buggered the WP code ?? But I have kept all my modifications in my theme, so havent messed with the actual code…

    Thread Starter r2d2_r2d2

    (@r2d2_r2d2)

    …then somehow you’ve really buggered the WP code and I’d be curious what you may have edited…

    Bingo! I had forgot about testing permalink, and adding ‘echo $permalink ;’ in the get_permalink function code ??

    All sorted now, thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘the_permalink function returns permalink code’ is closed to new replies.