Renaming post formats after Gutenberg

I have renamed my post formats before, but since the Gutenberg update it doesn’t work anymore.

I tried Aaron’s translation-solution from the link below, but WordPress doesn’t use the translations in the back end. Is there a new way to do this? I am not experienced enough to be able to dig this out of WordPress myself.

The link: Is it possible to rename a post format?

This is my attempt:

function rename_post_formats( $  translation, $  text, $  context, $  domain ) {    $  names = array(     'Aside'  => 'Breaking News',     'Status' => 'Notice'   );    if ( $  context == 'Post format' ) {      $  translation = str_replace( array_keys($  names), array_values($  names), $  text );      var_dump( $  translation );   } return $  translation;  } add_filter( 'gettext_with_context', 'rename_post_formats', 10, 4 ); 

When I var_dump $ translation after doing the str_replace, it contains the new names, but WordPress doesn’t use it. Also, weirdly, it is dumped 5 times in a row (don’t know if that helps).

Help would be greatly appreciated!

How to detect underflow (post 11.3)?

This old trick used to work before 11.3:

SetSystemOptions["CheckMachineUnderflow" -> True] 

But no longer… so how can we explicitly check for this in v12+?

Now, not checking for underflow is smart in terms of speed, but can lead to crazy bugs that might be tricky to miss/debug:

z = 1.00000000000000000;  Do[z = 2*z - z, 50];  z == \[Pi] (* True... mind blown *) 

Is there any undocumented way to check for numbers of negative accuracy in a given scope?

Custom Post Type – Category Rewrite – Remove Rewrite from Sitemap

I’ve got “case_studies” post type and categories for it as “case_studies_categories” with a rewrite to include category in URL.

Everything works, but for some reason, rewrite url is in sitemap (as the first URL), for example:

/case-studies/%case_studies_categories%/ 

and the rest is fine:

/case-studies/%case_studies_categories%/ /case-studies/category-name/post-name/ /case-studies/category-name/post-name/ /case-studies/category-name/post-name/ 

How to remove it (/case-studies/%case_studies_categories%/) from Sitemap?

    add_action('init','case_studies_init');  function case_studies_init(){      $  labels = array(         'name'               => _x( 'Case Studies', 'Case Studies' ),         'singular_name'      => _x( 'Case Study', 'Case Study' ),         'add_new'            => _x( 'Add Case Study', 'Case Study' ),         'add_new_item'       => __( 'Add Case Study' ),         'edit_item'          => __( 'Edit Case Study' ),         'new_item'           => __( 'New Case Study' ),         'all_items'          => __( 'All Case Study' ),         'view_item'          => __( 'View Case Study' ),         'search_items'       => __( 'Search Case Study' ),         'not_found'          => __( 'No Case Studies Found' ),         'not_found_in_trash' => __( 'No Case Studies in Trash' ),         'parent_item_colon'  => '',         'menu_name'          => 'Case Studies'     );     $  args = array(         'labels'                => $  labels,         'description'           => 'Holds case studies post data',         'public'                => true,         'menu_position'         => 7,         'hierarchical'          => true,         'menu_icon'             => 'dashicons-admin-comments',         'rewrite'               => array('slug' => 'case-studies/%case_studies_categories%', 'with_front' => false),         'supports'              => array( 'title', 'revisions', 'thumbnail'),         'has_archive'           => true,         'show_ui'               => true,         'show_in_nav_menus'     => true,         'show_in_menu'          => true,         'show_in_admin_bar'     => true,         'taxonomies'            => array("case_study_categories"),     );      register_post_type('case_studies',$  args);   //  flush_rewrite_rules( false ); }  // register a custom category taxonomy type // so that the categories are not connected to the 'post' type taxonomies  add_action( 'init', 'register_case_study_tax' );  function register_case_study_tax(){      $  labels = array(     'name'              => _x( 'Case Study Categories', 'case-studies'),     'singular_name'     => _x( 'Case Study Category', 'testimonials'),     'search_items'      => __( 'Search Case Study Categories'),     'all_items'         => __( 'All Case Study Categories'),     'parent_item'       => __( 'Parent Case Study Category'),     'parent_item_colon' => __( 'Parent Case Study Category:'),     'edit_item'         => __( 'Edit Case Study Category'),     'update_item'       => __( 'Update Case Study Category'),     'add_new_item'      => __( 'Add Case Study Category'),     'new_item_name'     => __( 'New Case Study Category'),     'menu_name'         => __( 'Case Study Categories'),     );      $  args = array(     'labels'                => $  labels,     'taxonomy'              => 'case_study_categories',     'object_type'           => 'case_studies',     'hierarchical'          => true,     'show_ui'               => true,     'show_admin_column'     => true,     'query_var'             => false,     );      register_taxonomy('case_studies_categories', 'case_studies', $  args); }   /** filter URL link for post type url **/ add_filter('post_type_link', 'case_studies_permalink_structure', 10, 4);  function case_studies_permalink_structure($  post_link, $  post, $  leavename, $  sample) {   if ( false !== strpos( $  post_link, '%case_studies_categories%' ) ) {     $  event_type_term = get_the_terms( $  post->ID, 'case_studies_categories' );     if($  event_type_term)     $  post_link = str_replace( '%case_studies_categories%', array_pop( $  event_type_term )->slug, $  post_link );    }  return $  post_link; } 

I’m sure I’ve done something stupid, please assist if possible.

Thanks,

How to search a post knowing only taxonomy value?

I have created a search bar with auto-completion which trigger the property-search.php script. The search function is working well, but for the moment I can only search for the post name, eg:

$  args = array(     'post_type' => 'zoacres-property',     'posts_per_page' => absint( 10 ),     'order'   => 'DESC',     's'       => esc_attr( $  _GET['prop_name'] ),     'meta_query' => $  meta_query,     'tax_query' => $  tax_query );  $  query = new WP_Query( $  args ); $  found_posts = $  query->found_posts; 

My goal is allow the user to search a property using the name of the property (as already did), the property region and the zone.

For enable the property region and zone, I used the meta_query parameter and filled the array with the taxonomy linked to the property, eg:

$  region_tax_array = array(     'key' => 'property-region',     'value' => 'foo', //only for test purpose     'compare'=> 'IN' );  $  meta_query = array(     'relation' => 'AND',     $  property_region ); 

the main problem here is that no content is returned, and that is strange ’cause the table contains the following values:

wp_terms

term_id | name | slug | term_group     62      foo    foo       0 

wp_term_taxonomy

term_taxonomy_id | term_id | taxonomy             62              62      property-region      

wp_term_relationships

 object_id | term_taxonomy_id |      29848           62 

what I did wrong?

get all properties of custom post type

Specifically, I’m trying to get get the ‘Layout Group’ of a given ThemeREX Custom Layout (which as I understand is just a Custom Post Type), but am also interested in seeing what other properties are available for that post.

I tried

print_r(get_post_meta(get_post(1738, 'ARRAY_A', 'display'),"",true)); 

but all that was returned was the number 1.

I”m guessing the meta is not what I’m looking for. Is there a way to iterate through all the custom properties that are registered with that post’s CPT?