• Resolved aryanduntley

    (@dunar21)


    *78296689 FastCGI sent in stderr: “PHP
    message: PHP Fatal error: Uncaught ArgumentCountError: Too few
    arguments

    …/public/wp-content/plugins/wp-snap-extended/wp-snap.php(277):
    apply_filters(‘posts_request’, ‘SELECT wp_posts…’)
    #3
    …/public/wp-content/plugins/wp-snap-extended/wp-snap.php(119):
    wp_snap_core->navigation(‘post’, true)
    …/public/wp-content/themes/yourgarden/archive.php(214): wp_snap(‘cat=31&child=tr…’)
    #5

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

    (@dunar21)

    Oops, this plugin hasn’t been updated in 7 years haha. Line 277 of wp-snap.php should be removed for php 7 and any more recent versions of WP.

    If you wish to apply the posts_request filters to the query before executing, you will have to rewrite the plugin because it is using $wpdb and not WP_Query. WP_Query is the second parameter of of the posts_request filter and if any other code is passing in the second parameter, you will likely get a fatal error in wp-snap.

    I’ve been using this plugin for years, and I’m expecting it to die one day, but it’s integral to the site I use it on (if it stops working, I may have to switch to Drupal to achieve the same thing, which seems excessive…). I keep hoping someone will take up the mission of updating it, but that seems increasingly unlikely. I should try to learn more php and do it myself, but that may be an equally unlikely occurrence.

    Thanks for the information. Maybe I can keep it going a little longer!

    H.

    Thread Starter aryanduntley

    (@dunar21)

    I only briefly looked at this for a client that is using it on a not very active part of their site. WP Snap was a decent plugin, but to create something similar is extremely easy with a custom query:

    $first_char = ‘B’;
    $second_char = $first_char;
    if(ctype_upper($first_char)){
    $second_char = strtolower($first_char);
    }else{
    $second_char = strtoupper($first_char);
    }

    global $post;

    $cposts = $wpdb->get_results($wpdb->prepare(“SELECT * FROM $wpdb->posts WHERE SUBSTR($wpdb->posts.post_title,1,1) = %s || SUBSTR($wpdb->posts.post_title,1,1) = %s ORDER BY $wpdb->posts.post_title”, $first_char, $second_char));

    if($cposts){
    foreach($cposts as $post){
    setup_postdata($post);
    the_title();
    echo ‘<br/>’;
    }
    wp_reset_postdata();
    }

    I only just noticed your custom-query reply today, aryanduntley. Thanks. I might give it a try when I have a moment!

    H.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Too few arguments error’ is closed to new replies.