Support

Account

Home Forums Front-end Issues ACF (free) problem – fetched only 10 newest custom posts

Solved

ACF (free) problem – fetched only 10 newest custom posts

  • Hi,

    I’ve a problem – I can fetch only 10 newest posts although I have created more than 20 posts. I have WordPress as a backend and React as a frontend.

    I’ve created a custom post type:

    $labels = array(
      'name'          => __( 'Parts' ),
      'singular_name' => __( 'Part' ),
    );
    $args = array(
       'labels'       => $labels,
       'public'       => true,
       'has_archive'  => true,
       'show_in_menu' => true,
       'show_in_rest' => true,
       'posts_per_page' => 100,       (THIS SHOULD HELP?)
       'rest_base'    => 'parts',
       'supports' => array('title')
    );
    register_post_type(...

    and I use ACF to add content into posts.
    I have setting on WordPress: Settings => Reading => Blog page show at most 900 posts. (SHOULD HELP?)

    There is shown only 10 posts at the url “…wp-json/wp/v2/parts” and only 10 posts in the json fetched by frontend:

    const response = await fetch(partsDataUrl);
        if (!response.ok)
        {
        	throw Error(response.statusText);
        }
        else
        {
        	const json = await response.json();

    What could be the reason?

  • I tackled this now by creating own custom endpoint to fetch all custom posts.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.