How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?

Two words – variable scope. Use a closure instead and pass $rstax through with use: add_filter( ‘new_royalslider_posts_slider_query_args’, function ( $args ) use ( $rstax ) { return array( ‘post_type’ => ‘carousel-slide’, ‘orderby’ => array( ‘menu_order’ => ‘ASC’ ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘carousel-slide-category’, ‘field’ => ‘slug’, ‘terms’ => $rstax, ), ), ) } … Read more

Why I can not I use the variable outside my function?

The problem here is order, the $post variable isn’t available from the moment WordPress is loaded, it needs to process the request, put together a database query, and retrieve the post first. Time travel is necessary for your code to work as you expected. Your themes functions.php and plugins will be loaded before this happens … Read more

Integer based rewrite isn’t recognized for value of 1

Rewrite rules in WordPress should point to index.php, and to substitute a matched value (number from address) to URL parameter (item_id) you must use $matches[1] instead of $1. So your rule should look like this: add_rewrite_rule(‘^add-item/([0-9]+)/?’, ‘index.php?item_id=$matches[1]’, ‘top’); You usually need to complete the rule with information about what is displayed. For display: single post … Read more

Query Vars Not Set in Main Query

Query vars are… fun like that. Depending on which archive you are messing with get_post_type() just might be simple enough to do it (it gets type from actual post, not query). Otherwise you might want to go for get_queried_object() to figure out what precisely you are dealing with.

How to: wordpress job listing and candidates details

You say that the listing is a custom post type so each job listing has a post ID so you can just pass that to your uploadcv.php in your Apply Now Button : <a href=”https://wordpress.stackexchange.com/questions/22457/.uploadcv.php?listing_id=<?php echo $post->ID; ?>”>Apply Now</a> and then retrieve that in your uploadcv.php : $listing_ID = (int)$_GET[‘listing_id’]; Now as far as saving … Read more