How to get image from url from the database?

I’d highly recommend to escape all values before output, e.g. echo esc_html( $retrieved_data->NAME ). The same for the image: <img src=”https://wordpress.stackexchange.com/questions/292680/<?php echo esc_url( $retrieved_data->icon ); ?>” /> You can read more about Securing Output in the developer handbook.

Query custom post types & Taxonomies and list them in a table on a page

You can use term_query in WP_Query: $args = array( ‘post_type’ => ‘all_parks’, ‘posts_per_page’ => -1, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘all_park_categories’, ‘field’ => ‘slug’, ‘terms’ => ‘national_parks’, ), ), ); $all_parks = new WP_Query( $args ); Query all posts with all categories and sort by term or create … Read more

Filter by field with array value in ACF on WP REST API

Advanced Custom Fields stores values for multiple select fields as a serialised Array. For a select field with options ‘one’ and ‘three’ selected, the value stored on the database would look like this: ‘a:2:{i:0;s:3:”one”;i:1;s:5:”three”;}’ It is simply not possible with WP_Query (which is where your meta query ends up) or SQL to filter results based … Read more

Pass return-path additional parameter in wp_mail

Yes! There’s a plugin that does this, and it’s very simple. It uses the phpmailer_init to adjust the $phpmailer object. This is the code it uses: if ( ! function_exists( ‘wp_mail_returnpath_phpmailer_init’ ) ) { function wp_mail_returnpath_phpmailer_init( $phpmailer ) { // Set the Sender (return-path) if it is not already set if ( filter_var( $params->Sender, FILTER_VALIDATE_EMAIL … Read more

Open and closed function [closed]

$open = “our lines are open”; $closed = “our lines are closed”; if ( time() >= strtotime( ’09:00:00′ ) && time() <= strtotime( ’17:00:00′ ) ) { echo $open; } else { echo $closed; } Somethinh like this should help you.

How to hide specific categories from contributors

You’ll have to change see_special_cats to something fitting. As you want to exclude contributors, but allow all others, you could use publish_posts (See the codex for all capabilities of contributors). Your code should be something like add_filter(‘list_terms_exclusions’, ‘yoursite_list_terms_exclusions’, 10, 2); function yoursite_list_terms_exclusions( $exclusions, $args ) { global $pagenow; if (in_array($pagenow,array(‘post.php’,’post-new.php’)) && !current_user_can(‘publish_posts’)) { $exclusions = … Read more