Getting posts by taxonomy

I usually use the tax_query parameter: $args = array( ‘post_type’ => ‘my_cpt_name’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘uom_system’, ‘field’ => ‘slug’, ‘terms’ => ‘metric-system’ ) ) ); $results = get_posts( $args ); See http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

Custom Post Types database persistance. Why not?

I don’t think there is definitive answer (there might be old discussion buried in some ticket), but I can offer some historical perspective. WordPress didn’t start with Custom Post Types. They were relatively late addition. While they were modeled after native post types, those still remain kind of special case. So the concept of such … Read more

how to Update 15k products on plugin activation with meta_option

Based on Paul’s original comment, we moved the code execution to a custom wp-cli command. Which also allowed us add arguments and change code behaviour based on arguments. Example code for anyone, including WPML language specification via global $sitepress; $sitepress->switch_lang(“en”); … ‘suppress_filters’ => false, <?php /** * Registers CLI command csa * * Allows to … Read more

Is there a way I can fetch the WordPress Developer Code References with an API?

It seems to be accessible from: https://developer.wordpress.org/wp-json/wp/v2/wp-parser-class https://developer.wordpress.org/wp-json/wp/v2/wp-parser-method https://developer.wordpress.org/wp-json/wp/v2/wp-parser-hook https://developer.wordpress.org/wp-json/wp/v2/wp-parser-function and search with e.g. https://developer.wordpress.org/wp-json/wp/v2/wp-parser-function?search=get_post_embed but it’s probably best to generate your own with the WP Parser here: https://github.com/WordPress/phpdoc-parser This will create custom post types for wp-parser-hook wp-parser-function wp-parser-class wp-parser-method and related post meta (to e.g. store function input arguments, line numbers, class type, hook … Read more