Tag Info

New answers tagged

0

When a new post is created (regardless of status) post_name which is the slug is saved to the WP_Post object. You can fire off a wp_ajax_$youraction() in the backend to get the post object and return the slug. https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_(action) Cheerz, Wil.


2

As I already stated, straight from the codex exclude (string) Excludes one or more categories from the list generated by wp_list_categories. This parameter takes a comma-separated list of categories by unique ID, in ascending order As you have stated, you have to use the category slug. To make this possible and dynamic, I think the best will be to ...


-1

There's a small error on your first line of code. You should separate 'each' category with quotes in the array. So the first line should be: <?php $categories = get_categories(array('exclude' => 'apps', 'windows')); ?>


0

I found the answer on Wordpress' website and have tested the solution: https://codex.wordpress.org/Rewrite_API/add_rewrite_rule#Using_Custom_Templates_with_custom_querystring Create a Page Template Create a page template for stores and apply it to a page. $stores = get_query_var('stores'); Add a Rewrite Tag In your functions.php add a rewrite tag, ...


4

You can use the category__in argument: // use get_the_category( $post_id ) if you are outside the loop $categories = get_the_category(); if( $categories ){ $related_posts = get_posts( array( 'category__in' => $categories ) ); }


0

This'll probably have a few quirks, but in practice it'll do what you're after. Note that it's set to only work for posts (not pages or custom post types). All we're doing is using the wp_unique_post_slug filter, which runs after WordPress has generated it's own unique slug, and additionally checking it against all _wp_old_slug meta values. You'll see in my ...


1

I think you are running into trouble with these lines in wp_update_term(): 3287 // Merge old and new args with new args overwriting old ones. 3288 $args = array_merge($term, $args); https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/taxonomy.php#L3287 The array passed in gets merged with the data already in the DB. ...


2

This (in your functions.php) will turn it off (but see also the comment I've left): remove_action('template_redirect', 'wp_old_slug_redirect');


1

pagename is for request page (core page post type) by slug. What you want, if I understood correctly, is to get "attorney" posts that belongs to same case-log terms that current "case" post. I would do it something like this (not sure where you are going to execute the code, I've tried to code as universally as possible): if( is_singular( "case" ) ) { ...


1

Does the folder 'biljke' exist on the server by any chance?? i.e. do you have wp-admin, wp-content, wp-includes AND biljke as folders in your Wordpress root? [Reposted as an answer so it can be accepted, probably should have done that in the first place without trying to comment!]



Top 50 recent answers are included