Slow query

I’m using a plugin in WordPress called Business Directory Plugin to grab information from the database through a template. The query pulls all 400 records and displays their name, address, phone number and a short description. This seems to take 8 seconds to gather and show the information. Is there any way I could speed up and consolidate the following script:

[php]<?php $listing_id = get_the_ID(); ?>

<?php echo $title; ?> | <?php $arr = get_post_meta( get_the_ID(), ‘_wpbdp[fields][10]’, true );
foreach ( $arr as $item) :
echo “$item”;
endforeach; ?> <?php $field = wpbdp_get_form_field( 23 );
echo $field->value( $listing_id ); ?> | <?php $field = wpbdp_get_form_field( 6 );
echo $field->value( $listing_id ); ?> | <?php $field = wpbdp_get_form_field( 53 );
echo $field->value( $listing_id ); ?>[/php]

Is the query slow or is it the part that writes the output to the screen?

To tell you the truth i’m not sure. I put a page loader on it, but it doesn’t come in until the query is finished and the page starts to load.

It’s hard to even tell you where to look, I don’t see the SQL calls to the database, the database structure and indexes. A lot of information is missing to tell you where the slowdown might be.

well, let’s just look at the code… is there something in that which I can consolidate down?

The topic of this post said “Slow Query”, but you didn’t show us the query.

The code is fine, you can probably remove some context switching with all the open and closed PHP tags, but you’re talking fractions of milli-seconds.

You have a lot of functions being called

wpbdp_get_form_field
get_post_meta
get_the_ID

I don’t know what those functions do, no code for them.

It’s really hard to help without all the details, I’m not a WordPress so I’m not familiar with their functions.

Sponsor our Newsletter | Privacy Policy | Terms of Service