Support

Account

Home Forums Backend Issues (wp-admin) Page Link > Filter by post Format > miss "Standard" one

Solving

Page Link > Filter by post Format > miss "Standard" one

  • Hello,
    When setting a Page link field, there’s a Taxonomy filter that let the possibility to filter posts by a specific taxonomy and/or post format.
    Post format works fine except that it’s only possible to select all posts format except the “Standard” one (default one).
    Is there any solution to fix this bug or maybe set a parameter to be able to select “Standard” post format?
    Thank you for your help.

  • Hi @jonas

    I believe the page link field doesn’t have the option to set the post format. You can only set the post format from the rule options, which has the “standard” format. Could you please share some screenshots of the issue you had?

    Thanks 🙂

  • Hello!
    Thank you for your quick reply. Here’s 2 screenshots to show which post formats are available and not.
    As I understund, the page link field has a Taxonomy filter that allow to filter post by Post format. There’s 2 posts format available (the 2 I’ve allowed in theme support in function.php) but not the default one called “Standard”.
    Thank you for your help!

  • Hi @jonas

    Could you please tell me how did you allow the post formats in function.php file? Could you please share the code.

    It seems that you’ve added custom taxonomies to the post, not the post formats. That’s why ACF shows it in the taxonomy filter. This page should give you more idea about it: https://codex.wordpress.org/Function_Reference/register_taxonomy. In that case, you need to add the standard taxonomy to your functions.php file and assign it to your posts.

    I hope this makes sense 🙂

  • Hello James,
    Here’s how i allow post formats in function.php.
    As you probably know, it’s not needed to register “Standard” post format with
    add_theme_support( ‘post-formats’, … )
    As it’s the default post format. In the printscreen, you’ll see, I’ve added “Standard” post format anyway to try if the bug was not due to that, but it doesn’t change ACF behavior.

    I’m not sure to understund your second remark about “adding custom taxonomies to the post or post formats”.

    To clarify what I’ve currently:
    – I’ve default post with default taxonomy. I dont’ use a custom taxonomy.
    – I’m trying to add a ACF dropdown field to the posts edit form that allow editor to link another Post only if this related post has “Standard” post format registred. For that, i’m trying to filter the dropdown by “Standard” post format, but this option is not available. Currently in ACF parameters, to filter the dropdown by post format, there’s only “Link” and “Aside” post format. I’m wondering if this bug is not due to the fact that “Standard” post format can’t be registered by add_theme_support() and ACF takes registered Posts formats and “forgot” to add the standard one.

    Thank you very much for you precious help.
    Jonas

  • Hi @jonas

    I see the problem now. It seems that the post format will only show up in the list if you have a post set to that format. That was why I couldn’t find it.

    Unfortunately, there’s no “standard” format in WordPress. Instead, please try the following code:

    function my_page_link_query( $args, $field, $post_id ) {
    	
        // only show children of the current post being edited
        $args['tax_query'] = array( array(
                'taxonomy' => 'post_format',
                'field' => 'slug',
                'terms' => array('post-format-aside', 'post-format-gallery', 'post-format-link', 'post-format-image', 'post-format-quote', 'post-format-status', 'post-format-audio', 'post-format-chat', 'post-format-video'),
                'operator' => 'NOT IN'
        ) );
    	
        // return
        return $args;
        
    }
    
    // filter for a specific field based on it's name
    add_filter('acf/fields/page_link/query/name=page_link_field_name', 'my_page_link_query', 10, 3);

    That code will modify the page link query and get all the posts that don’t have any post format.

    This page should give you more idea about it: http://wordpress.stackexchange.com/questions/152882/how-to-query-posts-of-standard-post-format-for-real.

    I hope this helps 🙂

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

The topic ‘Page Link > Filter by post Format > miss "Standard" one’ is closed to new replies.