Files
igny8/igny8-wp-plugin/sync/hooks.php
IGNY8 VPS (Salman) bcee76fab7 Implement site structure synchronization between WordPress and IGNY8 backend
- Added a new API endpoint in the `IntegrationViewSet` to update the WordPress site structure, including post types and taxonomies.
- Implemented a function to retrieve the site structure and sync it to the IGNY8 backend after establishing a connection.
- Scheduled a daily cron job to keep the site structure updated.
- Enhanced the WordPress plugin to trigger synchronization upon successful API connection.
- Updated relevant files to support the new synchronization feature, improving integration capabilities.
2025-11-22 03:36:35 +00:00

43 lines
1.4 KiB
PHP

<?php
/**
* WordPress Hooks Registration
*
* Registers all WordPress hooks for synchronization
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Load sync class
require_once IGNY8_BRIDGE_PLUGIN_DIR . 'sync/post-sync.php';
/**
* Register WordPress hooks for IGNY8 sync
*/
function igny8_register_sync_hooks() {
// WordPress → IGNY8 hooks
add_action('save_post', 'igny8_sync_post_status_to_igny8', 10, 3);
add_action('publish_post', 'igny8_update_keywords_on_post_publish', 10, 1);
add_action('publish_page', 'igny8_update_keywords_on_post_publish', 10, 1);
add_action('draft_to_publish', 'igny8_update_keywords_on_post_publish', 10, 1);
add_action('future_to_publish', 'igny8_update_keywords_on_post_publish', 10, 1);
add_action('transition_post_status', 'igny8_sync_post_status_transition', 10, 3);
// Cron hooks
add_action('igny8_sync_post_statuses', 'igny8_cron_sync_post_statuses');
add_action('igny8_sync_site_data', 'igny8_cron_sync_site_data');
add_action('igny8_sync_from_igny8', 'igny8_cron_sync_from_igny8');
add_action('igny8_sync_taxonomies', 'igny8_cron_sync_taxonomies');
add_action('igny8_sync_keywords', 'igny8_cron_sync_keywords');
add_action('igny8_full_site_scan', 'igny8_cron_full_site_scan');
add_action('igny8_sync_site_structure', 'igny8_sync_site_structure_to_backend');
}
// Register hooks
igny8_register_sync_hooks();