justinwhall / wp-buildhook-deploy

WordPress plugin to trigger build hooks and deploy your static site.

Home Page:https://justinwhall.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Publishing/updating posts triggers both production and stage hooks

seanngpack opened this issue · comments

Hi, thanks for making this awesome plugin! I was wondering if anyone had the same issue: when I press publish/update on Wordpress, it triggers both my staging and production builds on Netlify no matter what combination of checked/unchecked boxes I select.

Looking at netlify, the deploys say they are triggered by their respective hooks--stage triggered by stage hook and production triggered by production hook.

I have the netlify hooks wired up correctly to wordpress and they api routes are unique. and the environment variables are correct.

Thanks!

Hey @seanngpack Tough to say without seeing more.

  1. Are you sure you have 2 unique webhooks saved in the plugin settings?
  2. Are you sure you don't have both checkboxes checked when publishing?
  3. What does your post object look like when you var_dump($_POST); die; here and update/publish a post?

Hi @justinwhall

  1. Yup, they are unique in the Wordpress plugin settings
  2. Yup, the checkboxes do nothing--the posts publish to stage and production no matter what combination of checked/unchecked.
  3. How do I check the post object? I looking through the deployment log on netlify for the hook triggered deploys but it's not there.

re #3, I'm suggesting you var_dump the post object but adding the code where I specified above.

Hi @seanngpack and @justinwhall, I have exactly the same issue. Did any of you manage to solve this or find a work around ?

EDIT : I have found a fix, will make a PR soon

EDIT 2: Don't have the right to push a branch, had to fork your repo to fix it

Hi @LorrisSaintGenez - you can still submit a PR if you fork the repo first.