PHP code example of plugin / yard-page-guard
1. Go to this page and download the library: Download plugin/yard-page-guard library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
plugin / yard-page-guard example snippets
define('YPG_AUTH_SALT', 'your-secret-salt');
define('OPENPDC_ENDPOINT', 'https://pdc.example.com/');
define('OPENPUB_ENDPOINT', 'https://pub.example.com/');
add_filter('yard::page-guard/post-types-to-use', function (array $postTypes): array {
return array_merge($postTypes, ['custom_post_type']);
});
add_filter('yard::page-guard/post-statusses-to-use', function (array $statuses): array {
return array_merge($statuses, ['private']);
});
add_filter('yard::page-guard/admin-roles', function (array $roles): array {
return array_merge($roles, ['editor']);
});
add_filter('yard::page-guard/review-user-login', function (string $login): string {
return 'ypg_review_user';
});
add_filter('yard::page-guard/enable-internal-data-sync', '__return_false');
add_action('yard::page-guard/after-internal-data-synced', function (int $postId, string $ownerLink, string $title): void {
// your code here
}, 10, 3);
add_action('yard::page-guard/after-internal-data-removed', function (int $postId): void {
// your code here
});
wp_schedule_event($this->timeToExecute(), 'daily', 'ypg_site_cron');
add_filter('cron_schedules', function ($schedules) {
$schedules['five_seconds'] = [
'interval' => 5,
'display' => '5 seconden',
];
return $schedules;
});
wp_schedule_event(time(), 'five_seconds', 'ypg_site_cron');