Unrendered content Cornerstone through REST API

This is expected, as it depends on the context. The raw content will show up for the edit but not the view or embed context. It’s filtered through the WP_REST_Controller::filter_response_by_context() method. You can always add a new field to the response with register_rest_field() where the get_callback callback receives an input array with post data, including … Read more

Can i check if user is doing any ajax request?

You’d be better off moving your function that updates the meta to a hook that runs on the front end and during AJAX calls. Then you don’t need to bother about checking if the request is an AJAX request or not. init is a good choice for this: function wpse_297026_update_user_activity() { update_user_meta( get_current_user_id(), ‘last_activity’, time() … Read more

Action ‘save_post’ not working for quick edit

It’s just a guess, since I haven’t tested your code, but… There is a part that looks pretty sketchy for me: All your actions are run only if this condition is true: if(isset($post_type) && $post_type == “listings”){ And where that $post_type variable comes from? $post_type = get_post_type(); So you don’t pass any post_id to that … Read more

Display a text message if the shortcode is not found?

do_shortcode() returns content with shortcodes filtered out. We can check the return value and display appropriate message accordingly. $output = do_shortcode( ‘[picu_list_collections email=”‘ . $current_user->user_email . ‘”]’ ); // the shortcode returns an empty <ul> tag, if there is no gallery // https://plugins.trac.wordpress.org/browser/picu/trunk/frontend/includes/picu-template-functions.php#L464 if($output == ‘<ul class=”picu-collection-list”></ul>’) echo “Nothing here”; else echo $output; I hope … Read more

WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end

Since this isn’t getting much action I’ll put our band-aid fix as the current solution. Problem 1 Solution The added item meta data shows on the order confirmation page and does not show on the confirmation email. We solved this by utilizing the woocommerce_order_item_meta_end hook to add the extra item meta. Problem 2 Solution Adding … Read more

Renaming wp-content folder dynamically

Don’t do what seems to be possible… You can use the possibility to change the WordPress constants WP_CONTENT_DIR and WP_CONTENT_URL in your wp-config.php. BUT it really, really, really, really is not recommended. Why? not recommended?? It’s pretty easy: Just do a cross file search (with your IDE or for e.g. Notepad++) for wp-content and you’ll … Read more

Rename image uploads with width in filename

I’ve managed to do it with the filter image_make_intermediate_size. Probably all the path/filename.extension dismembering and remaking could be optimized or made in a single stroke fashion, but alas, I’ll let that to the reader: // The filter runs when resizing an image to make a thumbnail or intermediate size. add_filter( ‘image_make_intermediate_size’, ‘rename_intermediates_wpse_82193’ ); function rename_intermediates_wpse_82193( … Read more

How can I get an XML export of my 1K+ posts WordPress instance?

You guys give up too easily 🙂 This worked for me: <?php require(dirname(dirname(__FILE__)) . ‘/wp-load.php’); require(ABSPATH . ‘wp-admin/includes/admin.php’); require(‘includes/export.php’); ob_start(); export_wp(); $xml = ob_get_clean(); file_put_contents(‘out.xml’, $xml); echo “done” ?>