How to Remove Default Category Metabox in Custom Post Types

I have approached this situation by using jQuery and CSS (this is code from a project that’s been in production for a few years that I generalized): // Admin Styles function style_custom_taxonomy_admin() { if (is_admin() && $_GET[‘taxonomy’] === ‘TAXONOMY’) { add_action(‘admin_footer’, function() { echo ‘<style>/* Custom admin styles */</style>’; echo ‘<script>jQuery(document).ready(function($){ $(“h2:contains(\”Heading to be hidden\”)”).length.remove(); … Read more

Preset category checkbox from URL parameter when creating new post

you can do that on php side with this hook : // the 2nd “post” of the hook is the post type add_action(“save_post_post”, function ($post_id, $post, $update) { if ($update) { // a post is updated return; } if (!isset($_GET[“preset_category”])) { return; } $term = get_term($_GET[“preset_category”]); if (isset($term)) { wp_add_object_terms( $post_id , $term->term_id , $term->taxonomy … Read more

Sort posts based on an acf field called fecha value return longtext ‘20240517’

You should be able to order your posts by adding the following to your main args: ‘meta_key’ => ‘date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, Example: $args_post = array ( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘meta_key’ => ‘date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘tipo-de-contenido’, … Read more