Relative Content

Tag Archive for javascriptphpwordpress

JavaScript not submitting a form

Im creating a WP plugin for some quizzes, the problem is that each question has a timer, and with JavaScript I’m trying to push the user to the next question if the user doesn’t answer the question during the given timeframe. I already tried to ask ChatGPT but I’m just unable to understand the error. The JavaScript console doesn’t display any error. So far if the timer reached 0 seconds, it “submits” the form but it only refreshes the page, resets the counter and doesn’t display the next question, however if I manually click the “Next” button it submits the question and goes to the next question.

WordPress pass data from php to an block

I am trying to pass data from a php array to my created Gutenberg block. I need this data to populate a select inspector control. Right now im using the wp rest api and fetching the data inside the array. However this method is very slow and I am wondering if there is a faster approach to getting this data. I only need the data when i create the inspector controls for the block.

Create a back button that skips specific page

I need to add a “Back” link that goes back 1 page (history.go(-1)) UNLESS the previous page is a specific URL. In that case, I want the link to go back 3 pages (history.go(-3)).