Plugin Directory

Changeset 2618809


Ignore:
Timestamp:
10/23/2021 03:14:40 PM (4 years ago)
Author:
eastsidecode
Message:

Updates function used to query the posts table

Location:
get-acf-field-label-from-name/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • get-acf-field-label-from-name/trunk/acf-field-label-from-name.php

    r2610660 r2618809  
    2222
    2323
    24   // avoid funtcion naming collisions
     24  // avoid function naming collisions
    2525
    2626  if (!function_exists('getAcfLabelByName')) {
     
    4949            $tableName = "{$wpdb->prefix}posts";
    5050
    51             $labelReturned = $wpdb->get_results( $wpdb->prepare( "SELECT `post_title` FROM `$tableName`
    52             WHERE `post_type` = %s AND `post_excerpt` = %s", 'acf-field', $fieldName ), ARRAY_A );
     51            $labelReturned = $wpdb->get_var( $wpdb->prepare( "SELECT `post_title` FROM `$tableName`
     52            WHERE `post_type` = %s AND `post_excerpt` = %s", 'acf-field', $fieldName ));
    5353
    5454            // grab the post_title from the result
    5555
    56             $fieldLabel = isset($labelReturned[0]['post_title']) ? $labelReturned[0]['post_title'] : 'Not Found';
     56            $fieldLabel = !empty($labelReturned) ? $labelReturned : 'Not Found';
    5757           
    5858
  • get-acf-field-label-from-name/trunk/readme.txt

    r2610660 r2618809  
    44Requires at least: 4.3
    55Tested up to: 5.8.1
    6 Stable tag: 1.0.0
     6Stable tag: 1.0.1
    77License: GPLv2 or later
    88
     
    2424== Changelog ==
    2525
     26= 1.0.1 =
     27*Release Date - 23 October 2021*
     28* Updated function used to query the posts table
     29
    2630= 1.0.0 =
    2731*Release Date - 07 October 2021*
Note: See TracChangeset for help on using the changeset viewer.