Using query_posts inside single.php loop

Inside of my loop in single.php, I used a custom query using get_posts to return posts belonging to a certain category. <?php global $post; $paged = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1; $myposts = get_posts(“paged=$paged&category=5”);?> <?php foreach($myposts as $post) :?> <?php the_title();?> <?php endforeach; ?> The problem is that the original loop, … Read more

WP 4.4.1 allow empty comments via add_action ‘pre_comment_on_post’

got a question about allowing empty comments with worpdress v.4.4.1 to achieve this i use the action ‘pre_comment_on_post’. in WP 4.3.1 i could do this easily: if (isset($_POST[‘comment’]) && $_POST[‘comment’] == “”) { $_POST[‘comment’] = “dummy content”; } the dummy content would be filtered out later via another add_filter call … in wp 4.3.1 in … Read more

store custom WP table names in a global variable

I was being creative and put this in one of the files loaded with my plugin. Are there implications with storing the table names this way? global $wpdb; if(!defined(‘DB_ARTISTS’)) define(‘DB_ARTISTS’, $wpdb->prefix . “artists”); if(!defined(‘DB_RELEASES’)) define(‘DB_RELEASES’, $wpdb->prefix . “releases”); EDIT: I had originally not included all of the information I had meant to. Tables and variables … Read more

How to access global $wp_meta_boxes variable on front-end?

Is there a way to take the global $wp_meta_boxes variable to be used in the front-end? Currently the $wp_meta_boxes is accessible on specific admin pages only. I’ve found a similar question about this. Its solution is to get the data via the do_meta_boxes hook, but I would like to access the variable without JS/AJAX, and … Read more