WordPress.org

Forums

get_permalink doesn't work after moving the site (5 posts)

  1. fanta00
    Member
    Posted 1 year ago #

    I have moved the site to another server, and everything works fine, apart from the links in my templates where I used
    <?php echo get_permalink(17); ?>
    Permalinks within menu work fine, I have resaved permalinks settings after move, but for some reason links within my tempalate with get_permalink do not work, they return this:
    <?php echo get_permalink(17); ?>
    Can't find answer anywhere, quite weird, have anyone got any ideas? Could it be server issue?

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Have you tried:

    - deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    - switching to the default theme to rule out any theme-specific problems.

    - resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    You haven/t indicated what version of WordPress you are using...

  3. fanta00
    Member
    Posted 1 year ago #

    Also maybe worth mentioning, I can't see .htaccess file, even though I have hidden files option enabled in my ftp, tested it on other ftp clients and still can't see the .htaccess file (I can see this file on any other server). Host says the file is there. I don't know why I can't see it. Can it be connected with issue above?

  4. Timothy
    Member
    Posted 1 year ago #

    Hi fanta00,

    With my limited knowledge:

    There is a bit in the 'Moving WordPress' codex that may help, see here.

    This part: If you had any kind of rewrites (permalinks) setup you must disable .htaccess and reconfigure permalinks when it goes live.

    Let me know if you're still having problems.

    EDIT: Hadn't seen esmi's post at time of writing, this may be irrelevant.

  5. fanta00
    Member
    Posted 1 year ago #

    Thank you both for so quick replies.

    Disabling plugins or theme wouldn't help, everything was working fine on a testing server, and the 'get_permalink' code just stopped working after moving site to the new server and new domain. The way the URLs are dispalyed now is:
    http://www.newdomain.com/<?php echo get_permalink(17); ?>
    (but only those were I used get_permalink in the template, all other links work absolutely fine)

    All old URL instances in a database has been replaced (I used Duplicator plugin).
    After moving the site I resaved the permalinks in Settings, would that fall into what Timtohy has suggested? I do not have access to .htaccess file using ftp, although my ftp is showing hidden files, I do not have access to control panel (client's server), and host is saying the file is visible, but I still can't see it, even when they changed permissions to 777

    All friendly urls and links are working on the site, just apart those put manually in the template using get_permalink code

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.