Articles of urls

taxonomy/category term in URL slug irrelevant for post?

so I’ve got a nice hierarchical system working involving custom post types and taxonomies. (see Custom post types, taxonomies, and permalinks for reference) So if I have a post with mysite.com/taxonomy/subtaxonomy/tastes-good , it works, and I can access taxonomy pages in mysite.com/taxonomy/subtaxonomy etc etc However, noticed a bug – I can put ANYTHING as part […]

TinyMCE Javascript URL Question

ed.windowManager.open({ file : url + ‘/shortcode_generator_popup.php’, I would like to move this file one folder above the current one that it’s in. I’m wondering how I can rewrite this so that is points to the folder above. I’ve tried: file : url + ‘../shortcode_generator_popup.php’ but of course it only turns into: /includes/js../shortcode_generator_popup.php Thanks for any […]

Changing custom post type URL issue

I have this function and it does just what I need, it replace words in URL perfectly, but links don’t work. All links are good and display on site well structured, as I wanted, but just don’t open posts. Is there any way that I can make it work? add_filter(‘post_type_link’, ‘replace_link’, 1, 3); function replace_link( […]

Using esc_url_raw with protocols properly

I’m trying to build up my own function to sanitize a URL before saving it to my WP database. However I cannot get esc_url_raw to trigger against unwanted protocols. The function below is letting all protocols through. function scientifik_sanitize_url($url){ $prots = array(‘http’, ‘https’); $item = $url; $sanitized = esc_url_raw( $item, $prots ); if ( is_wp_error( […]

Relative URLs within site

I want to link to a page inside a website so the url I want to link to is this: http://www.example.org/about-us/team when I set a link like that: <a href=”about-us/team”>Our Team</a> It doesnt work. I get to the site: http://about-us/team Is there a solution to that? The reason why is because after the Website is […]

Blog post – single.php url

I have a simple blog page that just lists blog posts on a page called ‘news’ http://my-site.co.uk/news I have a single.php page to display the actual post when it is clicked on ‘news’ The single.php displays the post but the url is http://my-site.co.uk/the-post-title. Is this normal or should it be http://my-site.co.uk/news/the-post-title How cam I get […]

How to add page under a custom post type?

I would like to add a page that uses a custom template (page-coffee-about.php), so it will appear under a custom post type called “coffee”. The URL of the custom page should be domain.com/coffee/about/. I already have a URL for domain.com/coffee that uses archive-coffee.php. I’ve searched and tried several different things (creating a coffee parent page, […]

How do you get all the urls of images attached to a post?

I’ve searched high and low and can’t seem to get it. I’m trying to output an XML feed with all the images attached to a post from a custom post type: </BasicDetails> <Pictures> <Picture> <PictureUrl><?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?></PictureUrl> <Caption></Caption> </Picture><Picture> <PictureUrl></PictureUrl> <Caption></Caption> </Picture> </Pictures> I’m using wp_get_attachment_url but it’s only returning one image (There’s […]

Redirect Image Url to a page via htaccess

I am trying to redirect Image Urls to a page. I have used 301 Redirection plugin, but that doesn’t seem to work. For ex : http://mywebsite.com/wp-content/uploads/2015/02/Contestant-11.jpg should redirect to mywebsite.com/page I have used ‘Link to’ to ‘Media File’ in individual image settings since I am using Social gallery plugin and it needs images to be […]

How to pass a PHP $_GET variable and fetch/output it?

I’ve already looked at the WordPress Codex, and looked around for other solutions online, but i still can’t seem to get it working. Basicly what i need is to pass a GET variable in an URL, and output it on the next page. Link http://www.website.com?foo=bar I’ve aleady tried fetching the GET variable like below: $foo […]