Fix missing meta field

Without the field, the story will not be queried. And updating the meta query is expensive.
This commit is contained in:
Tetrakern 2023-08-17 02:11:37 +02:00
parent 018661f8f4
commit a7f6f5c073
2 changed files with 5 additions and 20 deletions

View File

@ -212,7 +212,7 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
| `add_meta_boxes_comment` | `fictioneer_add_comment_meta_box`
| `admin_bar_menu` | `fictioneer_remove_comments_from_admin_bar`
| `admin_enqueue_scripts` | `fictioneer_admin_scripts`, `fictioneer_admin_styles`, `fictioneer_disable_moderator_comment_edit`, `fictioneer_hide_private_data`
| `admin_head` | `fictioneer_remove_update_notice`
| `admin_head` | `fictioneer_remove_update_notice`, `fictioneer_hide_story_sticky_checkbox`
| `admin_head-profile.php` | `fictioneer_remove_profile_blocks`
| `admin_init` | `fictioneer_register_settings`, `fictioneer_skip_dashboard`
| `admin_menu` | `fictioneer_add_admin_menu`, `fictioneer_remove_dashboard_menu`, `fictioneer_remove_comments_menu_page`

View File

@ -1173,33 +1173,18 @@ if ( ! current_user_can( 'manage_options' ) ) {
// === FCN_MAKE_STICKY =======================================================
/**
* Removes the custom ePUB CSS input field
* Hide the 'sticky in lists" checkbox
*
* @since 5.6.0
*
* @param array $fields An array of fields to be rendered.
*
* @return array The modified array.
*/
function fictioneer_remove_make_sticky_input( $fields ) {
// Fields to remove
$field_keys = ['field_619a91f85da9d']; // fictioneer_story_sticky
// Remove fields from the fields array
foreach ( $fields as $key => &$field ) {
if ( in_array( $field['key'], $field_keys ) ) {
unset( $fields[ $key ] );
}
}
// Return modified fields array
return $fields;
function fictioneer_hide_story_sticky_checkbox() {
echo '<style>[data-name="fictioneer_story_sticky"] {display: none !important;}</style>';
}
if ( ! current_user_can( 'fcn_make_sticky' ) ) {
add_filter( 'acf/update_value/name=fictioneer_story_sticky', 'fictioneer_acf_prevent_value_update', 9999, 3 );
add_filter( 'acf/pre_render_fields', 'fictioneer_remove_make_sticky_input', 9999 );
add_action( 'admin_head', 'fictioneer_hide_story_sticky_checkbox' );
add_action( 'post_stuck', 'unstick_post', 9999 ); // lol
}