You appear to be a bot. Output may be restricted
Description
Query the field name for a noderef pointing to this post typeThere may be more than one, but we're only going to take the first Entry from $bw_fields [_sc_param_code] => Array ( [#field_type] => noderef [#title] => Shortcode [#args] => Array ( [#type] => oik_shortcodes ) )
field_type = noderef
args #type = oik_shortcodes == $current_post_type
Note: for some post types (e.g. shortcode_examples ) the noderef points to a so we need to determine the meta key differently… the first noderef for the post typeUsage
bw_query_field( $current_post_type, $post_type );
Parameters
- $current_post_type
- ( string ) required – post type we're finding references to
- $post_type
- ( string ) optional – target post type or null
Returns
voidTO DO
this logic does not use the $post_type parameter but there are instances where it's passed in as if it should have been used. Need to reconsider what we're actually trying to achieve and how to achieve it ?Source
File name: oik-fields/shortcodes/oik-related.phpLines:
1 to 20 of 20
function bw_query_field( $current_post_type, $post_type=null ) { //bw_trace2(); global $bw_fields; global $bw_mapping; $meta_key = null; //bw_trace2( $bw_fields, "fields" ); //bw_trace2( $bw_mapping, "mapping" ); foreach ( $bw_fields as $key => $data ) { if ( $data['#field_type'] == "noderef" ) { $post_types = $data['#args']['#type']; $cpt_found = bw_check_noderef_types( $post_types, $current_post_type ); if ( $cpt_found ) { $meta_key = $key; bw_trace2( $meta_key, "meta_key" ); break; } } } return( $meta_key ); }View on GitHub