Can I access WordPress API’s from within plugin scripts?

I believe you’re using ajax refering the process_form.php. However the right way to access any ajax is through the wp-admin/admin-ajax.php. Pull all your code from process_form.php to a function (can be added on your main plugin file): function my_process_form() { //…code from process_form.php if ( ! $error ) { //your error boolean return wp_json_success(); //recommend … Read more

Best Method to Switch Between Terms (Custom Taxonomy)

If I am reading your code and description correctly, you can simplify that to: $taxonomy = ‘delivery_option’; $do = get_the_terms($post->ID,$taxonomy); if (!empty($do) && !is_wp_error($do)) { $do = array_shift($do); // assuming a single value as per the description. $term = str_replace(‘-delivery’,”,$do->slug); get_template_part(‘includes/sidebar-part’,$term); } else { echo ‘<p>No custom include!</p>’; } Note, I used WordPress’s get_template_part() instead … Read more

WP_Query for CPT with filter by another WP_Query

You’re correct in your approach. If you post your code will be better, but something like this: $args = array( ‘post_type’ => ‘project’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘region’, ‘field’ => ‘slug’, ‘terms’ => $region, //set your region ), ), ); $the_query = new WP_Query( $args ); // The Loop of Projects by Region … Read more