Skip to content

Customizing Default attributes for Posts Inserter block and JS Errors #1207

@tnog

Description

@tnog

Hi,

We're trying to customize the Posts Inserter block for the following cases:

  • Our site doesn't use the default Post and we wanted to change the default postType block attribute to one of our CPTs.
  • We wanted to also set displayAuthor to true so that the block would always inject the author.

I've tried a few different approaches to try to update the default attributes (theme.json, register_block_type_args filter, but none so far seem to work.

In addition, when trying to modify the block interface using some custom Javascript there appears to be an error that's preventing execution of any additional scripts.

mediaelement-and-player.js?ver=4.2.17:1034 Uncaught TypeError: Cannot set properties of undefined (setting 'mejs')
    at 7.3 (mediaelement-and-player.js?ver=4.2.17:1034:23)
    at s (mediaelement-and-player.js?ver=4.2.17:11:268)
    at mediaelement-and-player.js?ver=4.2.17:11:319
    at 6.2 (mediaelement-and-player.js?ver=4.2.17:570:13)
    at s (mediaelement-and-player.js?ver=4.2.17:11:268)
    at e (mediaelement-and-player.js?ver=4.2.17:11:439)
    at mediaelement-and-player.js?ver=4.2.17:11:468
7.3 @ mediaelement-and-player.js?ver=4.2.17:1034
s @ mediaelement-and-player.js?ver=4.2.17:11
(anonymous) @ mediaelement-and-player.js?ver=4.2.17:11
6.2 @ mediaelement-and-player.js?ver=4.2.17:570
s @ mediaelement-and-player.js?ver=4.2.17:11
e @ mediaelement-and-player.js?ver=4.2.17:11
(anonymous) @ mediaelement-and-player.js?ver=4.2.17:11
mediaelement-migrate.js?ver=6.2.2:4 Uncaught ReferenceError: mejs is not defined
    at mediaelement-migrate.js?ver=6.2.2:4:2
    at mediaelement-migrate.js?ver=6.2.2:84:3
(anonymous) @ mediaelement-migrate.js?ver=6.2.2:4
(anonymous) @ mediaelement-migrate.js?ver=6.2.2:84
jquery.js?ver=3.6.4:4095 Uncaught TypeError: $(...).not(...).filter(...).mediaelementplayer is not a function
    at HTMLDocument.initialize (wp-mediaelement.js?ver=6.2.2:84:6)
    at mightThrow (jquery.js?ver=3.6.4:3802:29)
    at process (jquery.js?ver=3.6.4:3870:12)

We've tested with plugins disabled, and with the default Twenty Twenty-Three theme with the same errors showing up.

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