Where to add my PHP codes for AJAX Jquery to work?

Here is a general scenario for adding PHP code snippets in WordPress theme or plugin. Scenario 1: Theme is your custom made theme. In this case, you can add code snippets in your own desired way (and obviously in standard way since you are the author of the theme). Scenario 2: Theme is either premium … Read more

Ajax filter with loadmore button

You could possibly look at doing this the same way that WP Job Manager does: https://github.com/Automattic/WP-Job-Manager/blob/master/assets/js/ajax-filters.js This is done by triggering a handler to make the query defining what “page” the query should run against. I would recommend using that as an example to build off of, as it works with both filters applied and … Read more

Get the ID of a page in Parent combobox in editor

After some time reading the Editor Documentation I found the proper solution. This is how you can listen to changes and get the id of the Parent Combobox select in the WP Editor: wp.data.subscribe( function () { var newParent = wp.data.select(‘core/editor’).getEditedPostAttribute(‘parent’); console.log(newParent); } ); wp.data.subscribe is called every single time a change occurs in the … Read more