Get postId in a wordpress pattern file?

In block themes patterns won’t have access to context such as id it seems: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-patterns One has to create a custom block to get post id and use useSelect hook to get post Id like so: import { useSelect } from “@wordpress/data”; … inside Edit block function: const postId = useSelect(select => select(‘core/editor’).getCurrentPostId()); then, postId … Read more

How to use isSavingNonPostEntityChanges in the same scope correctly?

This seems to be the no-shadow rule. The problem is that it doesn’t like that you have defined two variables with the same name: isSavingNonPostEntityChanges (see code comments below). const { isSaving, isSavingNonPostEntityChanges } = useSelect((select) => { // <– here const { isSavingPost, isSavingNonPostEntityChanges } = select(editorStore); // <– and here return { isSaving: … Read more

Elements positioning in a custom block

You would need a combination of JavaScript for the custom block, and CSS to make the H1 span across both columns. The JavaScript would be like this: registerBlockType(‘my-plugin/two-columns’, { title: ‘Two Columns’, icon: ‘screenoptions’, category: ‘common’, attributes: { title: { type: ‘string’, }, imageUrl: { type: ‘string’, }, }, edit({ attributes, setAttributes }) { const … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)