How to embed a new string in url?

try this add_filter( ‘rewrite_rules_array’,’my_insert_rewrite_rules’ ); add_filter( ‘query_vars’,’my_insert_query_vars’ ); function my_insert_rewrite_rules( $rules ) { $newrules = array(); $newrules[‘(.+?)/custom_post_type_slug/(.+?)/?$’] = ‘index.php?post_type=custom_post_type_slug&dynamic_string=$matches[1]&custom_post_type_slug=$matches[2]’; return $newrules + $rules; } function my_insert_query_vars( $vars ) { array_push($vars, ‘dynamic_string’); return $vars; }

unique identifier for the same pages in a multilanguage/site context

For people, as me, that comes to this thread, looking for a solution, pll_get_post() is your function. I think this is the easiest solution for this problem. $the_translated_page = get_page_by_title( ‘Custom page’ ); $the_translated_page = pll_get_post( $the_translated_page->ID ); $the_translated_page_URL = get_permalink( $the_translated_page ); I’m pretty sure that this function (pll_get_post) was recently included in the … Read more

“set_front” => false on custom post type breaks wp_list_categories links [closed]

The parameter you are using is wrong. There is no set_front parameter when you register a Custom Post Type. The appropriate parameter is with_front. ‘with_front’ => bool Should the permastruct be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true http://codex.wordpress.org/Function_Reference/register_post_type#Arguments

how to set up wp in folder within static website?

It sounds like you need to copy the file /blog/index.php to /index.php and modify a line in the new copy you create: require(‘./wp-blog-header.php’); to require(‘./wordpress/wp-blog-header.php’); Here is a complete guide to moving WordPress into a separate folder: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Update the permalinks in posts (not domain change)

Question interested me, so I took a shot. Not tested, so recommend backing up the wp_posts table before running (though you should do so regardless!) As mentioned in the comments, don’t forget to replace “domain.com” in the regular expression with your own. require ‘wp-load.php’; // Only needed if *not* a plugin. function out_with_the_old( $match ) … Read more

Internal linking to posts permalink fail because of spaces and stripe at postname

Spaces are invalid characters in URLs. Your links are broken, whether the posts exist or not and regardless of whether you want the spaces or not. And uppercase/lowercase can get you in trouble too. Some servers are case sensitive so if you have a permalink to http://somesite.com/hello-world a link like http://somesite.com/Hello-World might work or it … Read more