Display selected category on post page

Lets assume that we have a post which belongs to 2 or more categories and we wish to display, on the post page, the selected category through which we reached to the post page. What is the best method? Keep the category id in a session or in a querystring temporarily? Or any other? THX Source: https://wordpress.stackexchange.com/feeds

Use the same taxonomy twice on the same post type?

Hello there basically I am quite good with WP however it is not easy for me to find a solution to this problem: There is an taxonomy which will consist of hundreds and mayby thousands of items. This taxonomy is called « Stones ». There is a custom post type called « item » (for sale) which consists of 1..n « stones » in the « main part » and of 1..n « stones » in the « additional part » In other words the same taxonomy should appear using different labels for the same post type twice (Stones contained in the…

How to change the post author when the post is published?

I wanted to change the author when a post change from draft to publish. I have $_GET[‘auth_id’] variable in post edit screen like this …wp-admin/post.php?post=53&action=edit&auth_id=5. I tried save_post hook to change the post author like below function change_pos_auth($post_id){ if ( ! wp_is_post_revision( $post_id ) ){ // unhook this function so it doesn’t loop infinitely remove_action(‘save_post’,’change_pos_auth’); if ( isset($_GET[‘auth_id’]) ) { $args = array(‘ID’=>$post_id,’post_author’=>$_GET[‘auth_id’]); // update the post, which calls save_post again wp_update_post( $args ); } // re-hook this function add_action(‘save_post’,’change_pos_auth’); } } This doesn’t work out may be this might…

Paginate_links links not working accordingly to how I do query the page

Ok, I’ve a custom post type page to which I have attached the paginate_links function to navigate through the elements. If I don’t do anything and let WP using whatever mechanism is attached to the archive page, then the paginate_links work fine but the previous link never goes back to the page one. Changing manually the links works fine. On the contrary, if I do something like the answer suggested here, overriding the wp_query object, the paginate_links move to the second page but the « current » remains set always on page…

URL path for wordpress categories

If I have a file called category-sound.php which corresponds to a category in a taxonomy called campaigns for a custom post type called awareness campaigns. what is the url path for this page? website.com/sound ? website.com/campaign/sound ? Source: https://wordpress.stackexchange.com/feeds

get_posts not honoring post_status

I have a custom post type ‘license’ with custom post statuses ‘active,inactive,cancel,expire’. However when I run a get_posts query to get only posts with active status it returns all the posts irrespective of the status. $active_licenses = get_posts( array( ‘post_type’ => ‘license’, ‘post_status’ => ‘active’, ‘posts_per_page’ => -1, ‘orderby’ => ‘ID’, ‘order’ => ‘DESC’, ) ); I am unable to figure out what am I doing wrong. Source: https://wordpress.stackexchange.com/feeds

Call to undefined function error after adding add_filter to wp-config

I am getting Fatal error: Call to undefined function add_filter() in example.com/wp-config.php on line 20 after adding add_filter( ‘auto_update_plugin’, ‘__return_true’ ); to wp-config.php My plugins.php file is present and add_filter() is defined inside of it. I just want to enable automatic updates for core, plugins and thems. What am I doing wrong? Source: https://wordpress.stackexchange.com/feeds

meta box on custom post type

Okay I have look on the site and need more help! I am adding Learndash to my site and need a meta box to show on their custom post type pages. Here is the meta box code I have which works fine for just normal posts; // META $prefix = ‘dbt_’; $meta_box = array( ‘id’ => ‘my-meta-box’, ‘title’ => ‘Post Customization’, ‘page’ => ‘post’, ‘context’ => ‘normal’, ‘priority’ => ‘high’, ‘fields’ => array( array( ‘name’ => ‘Post Color’, ‘id’ => $prefix . ‘color’, ‘type’ => ‘select’, ‘options’ => array(‘orange’, ‘pink’,…

I want to duplicate homepage for all my pages

I want to duplicate my homepage then call the pages A. page b & c. – So that I can edit just a few things on all the pages. I already have some pages but I can’t get bits exactly the same.I copied parts of style.css to header.php in the parent theme but didn’t work – maybe ’cause it calls to the main page at the end – If I delete the div main site at the end of the header.php I lose most of what I want. Here is…