Change default URL of image attachment
Change default URL of image attachment
Change default URL of image attachment
template_redirect is an action, it expects nothing to return back. What you are looking for is template_include filter I think. http://codex.wordpress.org/Plugin_API/Filter_Reference/template_include
So after discussing via chat, the problem is with Ps_Perry_Import_To_Post::wp(): final public static function wp() { … if(!empty($_GET[‘pid’]) && empty($_GET[‘r’])) { … wp_redirect(‘/malta-property/’.$_GET[‘pid’].”https://wordpress.stackexchange.com/”.$post_name.’?r=1′); exit(); } if(strpos($_SERVER[‘REQUEST_URI’], ‘/malta-property/’) !== false && empty($_GET[‘r’])) { … if (preg_match(‘/[A-Za-z]/’, $arr2[count($arr2)-1]) && preg_match(‘/[0-9]/’, $arr2[count($arr2)-1])) { // do nothing return null; } else { wp_redirect(‘/?pid=’.$arr1[2]); exit(); } } return null; } … Read more
Good plugin: http://urbangiraffe.com/plugins/redirection/ You can import CSV files of URLs to redirect, so use the string site:mydomain.com in Google to grab all your indexed URLs, get them into a file and when the WP site is live, import the file and then select the new target WP pages. The plugin has good 404 logging, too.
I have finally solved my rewrite rule problem. I used the class outlined in the answer of this wordpress.stackoverflow question. After including that class I used the following code to make it work: // These query vars can be retrieved on the page by using get_query_var( ‘queryvar1’ ); $options = array( ‘query_vars’ => array( ‘queryvar1’, … Read more
Nilambar’s comment solved this for me. “You can pass two values as comma separated in a single parameter events. And later parse value correctly in your page. – Nilambar” I use this to get posts with tag1 OR tag2: echo ‘<a href=”‘.esc_attr(add_query_arg( ‘events’, ‘tag1,tag2′)).'”>Linkname</a>’; And to get all posts with tag1 AND tag2 simply use … Read more
You can use the post_link_category filter to remove child categories from permalinks: function wpse147453_remove_child_categories_from_permalinks( $category ) { while ( $category->parent ) { $category = get_term( $category->parent, ‘category’ ); } return $category; } add_filter( ‘post_link_category’, ‘wpse147453_remove_child_categories_from_permalinks’ );
Mark Jaquith uses “+” as the search query string delimiter in his Nice Search Plugin. Here’s what he does: function cws_nice_search_redirect() { if ( is_search() && strpos( $_SERVER[‘REQUEST_URI’], ‘/wp-admin/’ ) === false && strpos( $_SERVER[‘REQUEST_URI’], ‘/search/’ ) === false ) { wp_redirect( home_url( ‘/search/’ . str_replace( array( ‘ ‘, ‘%20’ ), array( ‘+’, ‘+’ ), … Read more
Question why does wp_sanitize_redirect strip out @ signs, exactly? Anybody could anyway try to load a url with an @ sign in it – is there some security issue I’m not thinking about? Just take a look at the source: function wp_sanitize_redirect($location) { $location = preg_replace(‘|[^a-z0-9-~+_.?#=&;,/:%!]|i’, ”, $location); $location = wp_kses_no_null($location); // remove %0d and … Read more
You just set the WordPress directory in your WP General Settings to your top-level URL (www.site.com/), then copy index.php to the root directory of your site and modify it to load content from your actual wp directory. Step by step instructions are here: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory I did this for my personal web site: http://dannythorpe.com. The WP … Read more