From what I see is the issue within your code.
Your issue is that you try to fetch the post type in your nested if-statements from the current post, even though at the first if statement, you validate against it and break the function.
What you want to do instead is to validate the post type against the $client_id variable.
$client_parent = get_post( $client_id );
$post_type="";
if( ! empty( $client_parent ) && isset( $client_parent->post_type ) ){
$post_type = $client_parent->post_type;
if( $post_type === 'note' ){
//run your logic
}
}
In case it’s still not working, you might want to take a look at the documentation of the update_post webhook action.
Related Posts:
- How can I fetch data from another website to my wordpress website with mysql database
- PHP Creating a formula from mysql db values and db stored math operator
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- How to properly insert data into custom table via plugin
- Plugin update error message
- Keep one user logged for a year?
- Customizing subject in comment notification e-mails
- if plugin is active? check if plugin is enabled or not?
- pagination on data fetched using SQL query
- Check if variable is set in filter
- Cannot get wpdb data (Error in a simple fuction) [closed]
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- Checking the count within a foreach loop
- execute function after one completed
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- JQuery prepend a function
- Why can’t I call a (member) function from within a foreach?
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- wp_dequeue_script for a Plugin
- Need to replace Currency Shortforms
- wp_enqueue_scripts
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- How to get specific string/value from an array? php [closed]
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Plugin onclick button activate other plugin
- WordPress Stock Update Programatically
- Send email with list of active plugins upon activation/deactivation
- Using custom fields for image alt and title
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- How to translate wordpress error message
- Api external with wordpress
- All custom widgets are not showing in widget area at the same time
- speed up pagination for huge database
- Way to send multiple values for column to MySQL?
- Add the_post_thumbnail_url to a shortcode in function.php
- same user role or copy the user role to be same as the other role
- Different registration form for different roles
- Adding a Tag Parameter / Filter to My Shortcode
- More gentle way to hook WordPress custom url
- How to display results from a data table with an encrypted user id?
- How to add custom function to pluggable.php
- Check against server time to display SQL entries – Radio Station DJ Rotator Plugin
- Can you echo PHP code from a variable?
- add_action for publish_post doesn’t work
- WordPress Cache delete on plugin uninstall
- It possible to implement an adhoc php web application with wordpress?
- Create csv file in plugin
- Cannot access variables within a widget
- Is there any wordpress function to update a random post every 10 minutes?
- Calling an custom field from theme option at the frontend
- Posting code inside the post instead of in the template file using shortcode
- WordPress function to add text
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- Metabox Data not saving
- How to add a handler for a button in plugin?
- Contact Form 7: custom validation [closed]
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- MySql Query for WordPress
- date function not correctly returning date
- Doing action based on input from options menu
- Including a PHP file via a function that is part of a plugin?
- Showing author box on post detail page
- How to disable register and reset the password from WordPress admin panel?
- How use Dynamic hyperlink on each wordpress post?
- How to prevent page load on form submission
- Move related products after product summary? [closed]
- How to tweak a plugin without preventing it from updating
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- how to search through plugin in wordpress cimy-user-extra-fields?
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Woocommerce disable checkout on specific day
- Requires PHP version 5.3.0
- WordPress: code structure
- PHP if url extension action=discussion condition use [closed]
- Adding a script & php to functions.php
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Option value not getting updated until page refresh in WordPress
- Make plugin admin page visible to other roles
- WordPress Convert queries to slashes using function.php
- How to change all the urls of the WordPress site?
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- Split Million WordPress Post’s Into Multiple Database Server
- Getting 504 Gateway Timeout Error on AWS Server! [closed]
- WordPress issue – data is not showing in wp-admin, but when searching through database, all the data is there
- I want to allow certain file types on dokan upload files
- stop resize button for wordpress media
- Mixed results with is_page() WordPress function, when using $this, or self
- Read page- or post-content across different builder-plugins
- Remove posts that start with similar words (like a delete duplicate posts plugin)
- Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
- CPU Overloading due to some hooks
- Woocommerce change image based on a single attribute
- Import posts from a different database with the same old id
- Elementor: Exclude product categories when using “Source: Current Query”