Need to return a string as permalink insted of str_replace
Use get_term_link() to get the correct URL for a taxonomy term archive. $list .= “\n\t\t” . ‘<li><a href=”‘. get_term_link( $tag ) .'”>’.$name.'</a></li>’;
Use get_term_link() to get the correct URL for a taxonomy term archive. $list .= “\n\t\t” . ‘<li><a href=”‘. get_term_link( $tag ) .'”>’.$name.'</a></li>’;
There is nothing happening at one month, and nothing “locks” permalinks. There is no actual difference in the system, the only difference is in the initial multisite configuration interface. When you first define WP_ALLOW_MULTISITE to true, and visit the network screen, you get the initial setup menu which lets you set up the configuration. It … Read more
$_GET refers literally to ?p=1 part of URL. With pretty permalink if it’s empty then there is nothing to access. WordPress processed either case into query variables of WP_Query class. You should use get_query_var() to retrieve things like this, so in this specific case it would probably be get_query_var( ‘p’ ).
First issue- the permalink structure in Settings is only for the post post type, so your post_type_link function has no %types% tag to replace. Second- unless you want a very complicated (and less performant) solution, the simpler solution is to have a static prefix in your post type slug. With the URL http://domain.com/type/location/post-name/, WordPress has … Read more
When using the pagename query var with a parent/child page, the value should reflect the parent/child relationship, or it will cause a redirect. Instead of: pagename=profile try: pagename=faculty/profile
What I ended up doing was setting up an endpoint for food, like so: global $wp_rewrite; $wp_rewrite->add_endpoint( ‘food’, EP_PERMALINK | EP_PAGES ); $wp_rewrite->flush_rules(); function printview_query_vars($vars) { array_push($vars, ‘food’); return $vars; } add_filter(‘query_vars’,’printview_query_vars’); Then I’d get a url like http://mysite/pagename/food/fruits/shelves/ and the wp_query would contain something like food=>fruits/shelves, which then i can parse myself into a … Read more
Permalinks are cached in wp_options and every time you update them in the code, you should flush them. Visiting wp-admin/options-permalink.php does the trick. Optionally you can try to resave that page, despite the resave is not needed, but is worth nothing.
The good answer was from @Milo, but he haven’t posted any code, so I post here my result, for people coming here for the right answer. /* Add query var to authorized query var… */ add_filter( ‘query_vars’, ‘add_spectacles_query_vars’ ); function add_spectacles_query_vars( $query_vars ) { $query_vars[] = ‘spectacles-year’; $query_vars[] = ‘spectacles-month’; $query_vars[] = ‘spectacles-day’; return $query_vars; … Read more
I fixed the problem by editing my .htaccess file. I replaced it with the following. # BEGIN WordPress <IfModule mod_rewrite.c> ErrorDocument 404 /index.php?error=404 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
You can do this by checking the number of results returned by your query. Try this. <?php $rawfiltertag = get_post_meta( $post->ID, ‘_cmb_client_name’, true ); $filtertag = sanitize_title( $rawfiltertag ); // wp_query arguments $args = array ( ‘post_type’ => ‘post’, ‘meta_query’ => array( array( ‘key’ => ‘_cmb_client_target’, ‘value’ => $rawfiltertag ) ) ); // the query … Read more