- This topic has 2 replies, 2 voices, and was last updated 7 years, 6 months ago by .
- The forum ‘General Discussion’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
So I've finally got myself using AJAX, which is amazing, I'm a god, go me (this took me far too long to learn). My issue is, when I output a new query to the page, the format of the posts is all messed up. I believe this is because all of the hooks that fire on the initial load from functions.php, don't fire again for the new posts after I create a new query, but don't reload the page.
For example, if I had a hook that removed the title, and placed it somewhere else, that doesn't happen when I use ajax to query new posts, right? How does one get around this? Do I need to manually call all hooks that would effect formatting again?
When you run ajax, you are bypassing the page load and init functions where all of the hooks are run. You are calling data directly from the server. If you want hooks to fire, you need to reload the page. If you are using the jqXHR.always() function, you can try adding window.location.reload();.
© 2023 WPEngine, Inc.