Delete custom fields when deleting posts

The best way to do this is to use the wp_delete_post function as follows: wp_delete_post($post_id, true); //false (default) sends it to the trash This function accounts for comments, term_relationships, posts.post_parent, and postmeta.

Use meta_query to get title of associated post

Try setting $title_search = get_the_title($post_object); and then using it in your query as ‘value’ => $title_search: $args = array( ‘post_type’ => ‘journal_entry’, ‘meta_query’ => array( array( ‘key’ => ‘custom_author’, ‘compare’ => ‘LIKE’, ‘value’ => $title_search ) ) );

Uploading PDF using Media Uploader

please use this code…. (function( $ ) { $( ‘#uploadpdf’ ).on( ‘click’, function() { tb_show(‘Upload the pdf’, ‘media-upload.php?type=file&TB_iframe=1’); window.send_to_editor = function( html ) { fileurl = $(html).attr(‘href’); if(/\.pdf\b/.test(fileurl)){ $(‘#pdf’).val(fileurl); }else{ alert(‘Not a valid pdf file’); } tb_remove(); } return false; }); })(jQuery); </script>

Trying to reorder posts by custom field

You might want to take a look at the WooCommerce docs, there’s a good snippet there showing now to add custom sort orders. The link is http://wcdocs.woothemes.com/snippets/custom-sorting-options-ascdesc/ Once you’ve ‘defined’ your custom order you’ll of course need to set it as the default in the store settings.