Assign custom field value to $permalink

Hi guys,

ok I accept that this one is probably dead easy for those that know PHP, but I’m having terrible trouble trying to do this. The custom field (bml_url)which is created by one plugin is being populated with the correct url, the problem I’m having is in assigning this external url as the post_permalink. The code I tried is shown below, but it is not working for some reason :-[

Code:
[php] if (get_option(‘bml_linkbox’) == “bml_url”)

        {

        $permalink = get_post_meta($post->ID, "bml_url", true );

  }
			
		else {

                 $permalink = get_post_permalink($post_ID);

        		 }

    $permalink = urlencode($permalink);

[/php]

This code is part of a plugin for auto posting bookmarks & the idea is that whenever I use an external source for a post on my site (such as Youtube, RSS Feeds etc), I wanted the plugin to post the source url as the permalink & not the permalink to the post on my site.
Note: if I manually type in the external url to bml_linkbox, then it creates the post on the bookmark sites exactly as I want, but I’m trying to get it to do this dynamically by using the value of the custom field bml_url.

Any help very much appreciated ::slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service