Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter dacevid

    (@dacevid)

    Thank you for your answer @jakept

    I’ve had another idea but it doesn’t seem to work even if it should. Could you help me?

    as I am using ACF plugin, I have created a new custom field named ‘slides_number’, and I have added to one of my pages (the one with ID=194). Then in my view I do this:

    $slides_number = get_field('slides_number', 194);
    
          $args = array(
            'post_type' => 'post',
            'posts_per_page' => $slides_number,
            'meta_query' => array(
              array(
                'key' => 'sfeatured',
                'value' => 'super-sfeatured',
                'compare' => '='
              )
            ),
            'orderby'=>'date',
            'order'=>'DESC'
          );
          $the_query = new WP_Query( $args );

    But it doesn’t seem to get the value. What am I missing?

    • This reply was modified 6 years, 8 months ago by dacevid.
    Thread Starter dacevid

    (@dacevid)

    Thank you again @howdy_mcgee
    I tried those parameters but didn’t seem to improve performance. I have displayed the SQL query that is being generated and is this:

    SELECT cochewp_posts.ID FROM cochewp_posts INNER JOIN cochewp_postmeta ON ( cochewp_posts.ID = cochewp_postmeta.post_id ) INNER JOIN cochewp_postmeta AS mt1 ON ( cochewp_posts.ID = mt1.post_id ) INNER JOIN cochewp_postmeta AS mt2 ON ( cochewp_posts.ID = mt2.post_id ) WHERE 1=1 AND ( ( cochewp_postmeta.meta_key = '_wpcf_belongs_car_id' AND cochewp_postmeta.meta_value = '84431' ) AND mt1.meta_key = 'wpcf-power' AND mt2.meta_key = 'wpcf-gear' ) AND cochewp_posts.post_type = 'version' AND ((cochewp_posts.post_status = 'publish')) GROUP BY cochewp_posts.ID ORDER BY CAST(mt1.meta_value AS SIGNED) ASC, CAST(mt2.meta_value AS SIGNED) ASC LIMIT 0, 400

    I see that is doing the samme INNER JOIN 3 times with different alias and then uses all of them in the WHERE clause. This sounds weird to me, shouldn’t it be a single INNER JOIN? What do you think?

    Thread Starter dacevid

    (@dacevid)

    Hi @howdy_mcgee
    Thank you for your answer.

    I only call this function once per page load.

    I don’t need pagination.

    Could it be cause behind there are some INNER JOINs within the same table?

    I am lost

    Thread Starter dacevid

    (@dacevid)

    Thanks for answering @joyousli

    I’m using WP 4.9.5

    I am using ‘Regenerate Thumbnails’ 2.2.6

    Images are ok, always same size, and the name was easy (“captura”). It was loading all the images before (and there were so many), everything was perfect. I don’t know what changed.

Viewing 4 replies - 1 through 4 (of 4 total)