Can’t get title of latest post

You’re getting there! Couple of issues – you need to actually grab the latest posts before you can work on them. And post_title is not a property of the ID, but the object itself: if ( $posts = get_posts( ‘numberposts=1’ ) ) { $title = $posts[0]->post_title; // carry on sir } Note: Ensure you have … Read more

Can’t get plugin settings page to save data

While you are using Settins API, that’s why you don’t need to use update_option or add_option functions. Settings API would handle that by self. There were few issues that’s why your code is not working. 1. add_settings_section( ‘wpa_ad_insert_main’, ‘Ad Insertion Settings’, ‘wpa_ad_insert_section_text’, ‘wpa_ad_insert’ ); 3rd parameter is the callback function. Since, you don’t need this … Read more

How to Sort the Favorite Plugins Screen Alphabetically?

That page is rendered by the WP_Plugin_Install_List_Table class, which calls the function plugins_api(). In this function, we find two filter hooks that enable the manipulation of the table output: plugins_api_args and plugins_api_result. The problem is that the API doesn’t offer an ordered query, so we can only sort each page results. The solution is to … Read more

Error uploading plugin zip file

The top of your Plugin’s main PHP file must contain a standard Plugin information header. This header lets WordPress recognize that your Plugin exists, add it to the Plugin management screen so it can be activated, load it, and run its functions; without the header, your Plugin will never be activated and will never run. … Read more

WooCommerce: Change default country on the cart page [closed]

I have same issue, but need to set country to US, here is how I fix it: add_action(‘woocommerce_add_to_cart’ , ‘set_country_befor_cart_page’); function set_country_befor_cart_page(){ WC()->customer->set_billing_country(‘US’); WC()->customer->set_shipping_country(‘US’); } Hope it will help.

WP-Markdown treating java generics like HTML tags

I was trying to fix this for the longest time as well. It seems that the problem is not the rendering, but the editor – when you save, it updates your post. I found a checkbox under Settings -> Writing called “WordPress should correct invalidly nested XHTML automatically”. Unchecking this checkbox fixed the problem.

WooCommerce & Caching [closed]

Read the WooCommerce docs. I’ve run in to this before, and the following pages cannot be cached: Cart My Account Change Password Edit Address View Order Checkout Pay Order Received