This particular website is using Tubepress to display a youtube video gallery. Now, Tubepress recommends that, to define which video goes to the front part of the gallery, we should append the id to the url, like this:
http://mysite.com/videos.php?tubepress_video=somevideoid
So, i already have a an option stored with the default video ID for the videos page, but i’m getting some trouble in dinamically appending that value to the URL everytime the video page is loaded.
So far, i’ve tried URL Rewrites, with no luck, and then i found this: Custom URl parameter and it seemed to be exactly what i want. I figured there’s also a page_link filter hook, but there’s no documentation on it. So this still isn’t working and i’m not quite sure why.
Me actual code looks like this:
function append_parameter( $link, $my_parameter ) {
if(is_page('videos')) {
$my_parameter = get_option('featured_video_id');
if ( isset($my_parameter) ) {
$link = add_query_arg( 'tubepress_video', $my_parameter );
}
return $link;
}
}
add_filter( 'page_link','append_parameter', 10, 2 );
any ideas?
In the example you link this is how the parameter is added:
However, in your example you missed the link parameter.
Does it work if you replace it with:
?