וורדפרס מגרסה 5.5 מאפשר לבחור לבצע עדכון אוטומטי לתבניות ותוספים. הכוונה טובה כי עדכונים יכולים להציל לכם את האתר לפעמים אבל לפעמים גם להיפך. במיוחד אם אתם בונים אתר ללקוח ופוחדים שהוא יבחר את האופציה ויגרום לבעיה.
על ידי הקוד הבא תבטלו את האפשרות לבחור ביצוע עדכונים אוטומטיים. (אם הגדרתם עדכון אוטמטי בקוד זה לא יבטל את זה – מדובר רק בהסרת האפשרות מ ה UI).
// Disable plugins auto-update. add_filter( 'plugins_auto_update_enabled', '__return_false' ); // Disable themes auto-update. add_filter( 'themes_auto_update_enabled', '__return_false' );
כדי לאפשר או לא לאפשר עדכון אוטמטי (לא את האופציה ב UI אלא עדכון ממש) תצטרכו את הקוד הבא:
add_filter( 'auto_update_plugin', '__return_true' ); // false to disable add_filter( 'auto_update_theme', '__return_true' ); //false to disable
ומה אם תרצו לאפשר עדכון אוטומטי רק לתוספים מסוימים? את זה תעשו בעזרת הקוד הבא:
function auto_update_specific_plugins ( $update, $item ) { // Array of plugin slugs to always auto-update $plugins = array ( 'plugin slug 1', 'plugin slug 2', ); if ( in_array( $item->slug, $plugins ) ) { // Always update plugins in this array return true; } else { /* Else, use the normal API response to decide whether to update or not */ return $update; } } add_filter( 'auto_update_plugin', 'auto_update_specific_plugins', 10, 2 );
תוכלו גם לשלוט בעדכונים אוטמטיים של גרסת וורדפרס עצמה כולל חלוקה לפי סוג שחרור הגרסה.
0 0 דירוגים
דרג את הפוסט