Updated Wordpress site url but hyperlinks are still unchanged

I updated two site urls in the database. However, hyperlinks such as Top Menu are still redirecting to the old site. Any idea what it is? I'm new to WP. Thanks.

update_option('siteurl', 'http://example.com');  
update_option('home', 'http://example.com');

Edited:

<a <?php if( $item->hasLinkClasses() ) : ?>class="<?php echo $item->getLinkClasses(); ?>"<?php endif;?> <?php if( $item->hasLink() ) : ?>href="<?php echo $item->getLink();?>"<?php endif;?> <?php if( $item->getTarget() ) : ?>target="<?php echo $item->getTarget();?>"<?php endif;?> <?php if( $item->hasLinkAttribs() ) : ?> <?php echo $item->getLinkAttribs(); ?><?php endif;?>>

            <?php if ($item->getLevel() == 0) : ?>
            <span class="rt-item-border"></span>

Solutions

search check your database for this url is changed or not. static url will work same on server or localhost.

The best option is (I've used it several times) to use DATABASE SEARCH AND REPLACE SCRIPT IN PHP to update the urls in database because there are urls saved in database that needs to be changed. Download that script and follow the instruction on the site INSTALLATION & USE about the usage.

You have to upload it to your root directory of WordPress installation and run the script using something like http://example.com/searchandreplace.php, you should rename it before you upload it to your server.

Important: Once you use it then must remove the script from your server.

Tags: PHP / Wordpress

Similar questions

csv comma seperated url conversion from plain urls to hyperlinks
i have a csv file full of plain image links eg : http://www.domain.com/galleries/big/gallery_69_1481.jpg, i have over a thousand of them to convert to a gallery images in wordpress's post content i thought notepad ++ would be the easiest using regex. i cannot find anything that would allow me to prepend and append text on either end of the url to m...
Updated Site URL but it is not reflecting the changes
I have my Wordpress installation located in "webroot/example.com/WP" folder. Currently, http://example.com shows a 404 page not found error. However, http://example.com/WP loads the Wordpress site. In the Settings->General area, I have both Wordpress URL and Site URL set to http://example.com/WP Now, I would like to change only the Site URL to http...
saved_post post_updated firing before custom fields are updated, what function fires after custom fields are updated? wordpress
I have a problem, I want to update a custom user meta data field using another custom post field. It has to happen AFTER the whole post INCLUDING CUSTOM FIELDS saves / updates. But all the calls I find: update the basic post data, then call the action, THEN update the custom fields. saved_post & post_updated cause this code to be delayed by 1 s...
WP site URL changed to have HTTPS but still homepage does not redirect
I've changed the WP site URL to include https://www & it's been a while. Entire site is correctly reflecting it. But unless I add following in .htaccess, the home page does not redirect But, in case htaccess goes corrupt & gets regenerated, it skips this part. Then http://domain.com does not redirect to http://wwww.domain.com Even if that p...
Query last updated posts (posts updated in the last 24 hours)
I'm having some difficulty to find an example of how to create a loop with posts that had been updated in the last 24 hours. My idea is to have a page of posts or perhaps on the index.php a lists of posts that had been updated in the last day (24 hours from the time the query is done) Is this possible ? Is there any way to perform that query ? Than...
Compare custom taxonomies of updated post (or new post) [Updated with progress]
I am using the Transients API to cache category loops for a custom taxonomy. All works fine, but if I add a new post or update an existing one, I woud like to compare the taxonomy values and then clear the transients based on the difference in IDs and then clear the others. Transients have the following format, _transient_mouldings_cat_loop_141 whe...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.