Skip to content

Allow custom orderby in Gutenberg block preview #98

@christophrado

Description

@christophrado

We're using SCPO alongside custom blocks that allow setting a custom order of objects.
SCPO overwrites the orderby parameter in queries within blocks in the editor preview/admin.

I narrowed the issue down to line 498, where the check says
if (isset($wp_query->query['post_type']) && !isset($_GET['orderby'])) {
Changing this to
if (isset($wp_query->query['post_type']) && !isset($wp_query->query['orderby'])) {
allows for queries with custom orderby values within the editor.

I've not found any issues with rewriting this line. Orders set by SCPO still work in other admin screens. This might need more testing though. If this isn't conflicting with other screens, I'd welcome this change for better block compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions