WordPress.org

Ready to get started?Download WordPress

Forums

the_permalink function returns permalink code (6 posts)

  1. r2d2_r2d2
    Member
    Posted 8 years ago #

    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%/http://www.domain.com/cars/ford/

    where obviously I would just want

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

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

  2. Chris_K
    Member
    Posted 8 years ago #

    As admin, if you go to Options - General Options, what do you have set in the two URI fields? And do they have the "http://" in front?

  3. r2d2_r2d2
    Member
    Posted 8 years ago #

    They do indeed, yes.

    I have this for both:

    http://www.domain.com

  4. geoffe
    Member
    Posted 8 years ago #

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

    If what you want is http://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.

  5. r2d2_r2d2
    Member
    Posted 8 years ago #

    :)

    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: http://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...

  6. r2d2_r2d2
    Member
    Posted 8 years ago #

    ...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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.