wp_insert_post insert a post but return 0

I found the answer. Actually I was passing the template in the wp_insert_post. When I remove that parameter it returns the post ID. And with that post ID I used add_post_meta( $page_id, ‘_wp_page_template’, ‘tpl-favourites.php’ ); to set the template for that page. It is a common technique. I have just dig the code of a … Read more

Visual Editor – Colorize Shortcodes

Managed to get a working solution. What you need: TinyMCE Advanced plugin What you should do: Customize the Visual Blocks Plugin that comes with the TinyMCE plugin and add css classes for each element you would to highlight (just loop through all p elements and parse the innerHTML and check if it contains your specific … Read more

WordPress tax_input only if logged in

You can use wp_set_object_terms after the post is saved and in case it fails you will get reason for that ex: $new_lead = array( ‘post_title’ => $lead_name, ‘post_content’ => $lead_message, ‘post_type’ => ‘leads’, ‘post_status’ => ‘publish’, ); $lid = wp_insert_post($new_lead); $status = wp_set_object_terms($lid,$term_id,’lead-status’); Now this does the save but $status will hold the reason for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)