Problem with parent page slug only in WordPress admin

Edit. Here’s another solution to not mess with the edit slug button. The function get_sample_permalink_html in wp_admin/includes/post.php outputs the sample permalink and an edit button. It can be filtered like this: add_filter(‘get_sample_permalink_html’,’my_sample_permalink’,10,2); function my_sample_permalink ($page_link,$id){ $page = get_page($id); if($page->post_type == “page” && $page->post_parent) { $parent = get_page($page->post_parent); $page_link = preg_replace(“/(sample-permalink\”>).*?(<)/”,”$1″.home_url(“https://wordpress.stackexchange.com/”).$parent->post_name.”/$2″,$page_link); } return $page_link; } Can’t … Read more

Test site pages go to main site

Your htaccess file seems to be a little off. I would suggest the first part of the file should look like the following… <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /testsite/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /testsite/index.php [L] </IfModule> And that you store it in the ‘testsite’ folder not the root.

Problems with rewrite rule

I suspect you have a conflict with your query vars. id is already a WordPress query var, and type is a reserved word. You should use vars that you know will be unique among core and any plugin you may use by prefixing everything, like zilvinas_id and zilvinas_type.

Change permalink structure for pagination only

You could filter get_pagenum_link. The parameter has to be paged, not page then. add_filter( ‘get_pagenum_link’, ‘wpse_78546_pagenum_link’ ); function wpse_78546_pagenum_link( $link ) { return preg_replace( ‘~/page/(\d+)/?~’, ‘?paged=\1’, $link ); } But I would rather try to fix the broken rewrite rules.

get_posts post title permalink not working for last item in array

You should use a foreach loop instead, as the count index isn’t the best way to walk over an array. <?php $speakerarray = get_post_meta($post->ID, ‘cpt_food’, true); foreach($speakerarray as $foodname) : $posts = get_posts(array(‘name’ => $foodname, ‘post_type’ => ‘food’)); $post = $posts[0]; echo ‘<a href=”‘ . get_permalink( $post->ID ) . ‘>’ . $foodname . ‘</a><br>’; endforeach; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)