justinwhall / wp-buildhook-deploy

WordPress plugin to trigger build hooks and deploy your static site.
https://justinwhall.com
163 stars 28 forks source link

Publishing/updating posts triggers both production and stage hooks #5

Closed seanngpack closed 5 years ago

seanngpack commented 5 years ago

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!

justinwhall commented 5 years ago

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?
seanngpack commented 5 years ago

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.
justinwhall commented 5 years ago

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

LorrisSaintGenez commented 5 years ago

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

justinwhall commented 5 years ago

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