get_option(‘site_url’); not working anymore
-
Hi, the function <?php $mysiteurl = get_option(‘site_url’); ?> used to work like a charm, but all of the sudden it spits out non existing URLs. The matter of fact is that it does not work only when the function is called in a series of if statements like this:
<?php $test = get_post_meta($post->ID, 'whatever', true); if ($test=="10") echo "<a href='<?php echo $mysiteurl; ?>/a-page.html'>10</a>"; elseif($test=="11") echo "<a href='<?php echo $mysiteurl; ?>/another-page.html'>11</a>"; ?>
As I said it used to work fine, but all of a sudden it includes
<?php echo ; ?> right before /a-page.html or /another-page.html if it’s on the home page. If it’s in a post page it also includes the slug with the portion relative to the title of the post between <?php echo ; ?> and the URL of the site.So if it’s in the home what should be https://mysite.com/a-page.html turns into https://mysite.com/<?php echo ; ?>/a-page.html
If it’s in a post page it becomes https://mysite.com/post-title/<?php echo ; ?>/a-page.html
Needless to say this messes up all the links in the conditional statements.
What could it depend on?
Thanks in advance
- The topic ‘get_option(‘site_url’); not working anymore’ is closed to new replies.