Get the blog page URL set in Options
As of WordPress 4.5 you can use: get_post_type_archive_link( ‘post’ ); This handles the logic of getting the correct URL regardless of whether posts show up on the homepage or in a specified page.
As of WordPress 4.5 you can use: get_post_type_archive_link( ‘post’ ); This handles the logic of getting the correct URL regardless of whether posts show up on the homepage or in a specified page.
Some background on rewrite rules The WP Rewrite system looks complicated, but in fact it’s not that hard to understand how it works. It is used to parse pretty URLs (/designers/) as if they were non-pretty (/index.php?pagename=designers). The basic idea is that you have a list of rewrite rules, regular expressions that can match the … Read more
After combining a bunch of pieces of other answers I got it working! So here’s the solution for those of you who are struggling with this too: This post and this one helped me out some, so thanks to those guys. Note, all this code, plus your initial custom post type and taxonomy registration code … Read more
Change slug in your post type arguments to products/%product_cat%, and slug in your taxonomy arguments to just products, then flush your rewrite rules. WordPress should now handle /products/my-product-cat/post-name/! Now finally, we need to help WordPress a little with generating permalinks (out of the box, it won’t recognise the permastruct tag %product_cat%): /** * Inject term … Read more
get_permalink() is only really useful for single pages and posts, and only works inside the loop. The simplest way I’ve seen is this: global $wp; echo home_url( $wp->request ) $wp->request includes the path part of the URL, eg. /path/to/page and home_url() outputs the URL in Settings > General, but you can append a path to … Read more
Is this what you are looking for: get_permalink( get_page_by_path( ‘map’ ) ) get_permalink( get_page_by_title( ‘Map’ ) ) home_url( ‘/map/’ )
Go to All pages from Dashboard and find the parent page of your subpages site-map and privacy-statement. It must be named Home( your front page now ). Then hover on it and click Quick Edit. You should saw something like this: Change the slug from home-2 to home( I marked that field with red underline … Read more
Go to admin Click Settings Click Permalinks Select Post Name (for clean permalinks) or default Finally Click Save This rewrites .htaccess and wordpress permalinks may work in most cases if .htaccess is not created, make .htaccess with following can you also confirm mod_rewrite is enabled in your server?