Add custom post type as submenu

I have a custom post type called ‘Movies‘ that I want to add under WooCommerce menu after "Extensions" as you can see below:

enter image description here

The WooCommerce page URL is /wp-admin/admin.php?page=wc-admin

I tried:

register_post_type( 'movie', array(     'show_in_menu' => 'admin.php?page=wc-admin' ) ); 

but that didn’t work. I am able to set Movies under Tools, Settings, Post, etc everywhere else, just not inside WooCommerce. Any ideas why?

WP_Query: how to search tags in addition to a custom post type?

Below is what I have so far for a custom rest endpoint (‘placesdb/v1/search?term=’) for a custom post type (place). This successfully returns all the places that have the search term in the title or content. However, I also want to return all the tags (tag archive pages) that match the search term (the same result as calling the non-custom ‘/wp/v2/tags?search=’). Is it possible to somehow add the tag results to the place results? I already successfully did the front-end approach of calling the places and tags endpoints separately via ajax, but I would rather get all the data in one swoop. Hence my attempt at making this custom endpoint.

function placesSearch() {   register_rest_route('placesdb/v1', 'search', array(     'methods' => WP_REST_SERVER::READABLE,     'callback' => 'placesSearchResults'   )); } function placesSearchResults($  data) {   $  places = new WP_Query(array(     'post_type' => array('place'),     's' => sanitize_text_field($  data['term'])   ));    $  placesResults = array();    while($  places->have_posts()) {     $  places->the_post();     array_push($  placesResults, array(       'title' => get_the_title(),       'permalink' => get_the_permalink()     ));   }    return $  placesResults; } add_action('rest_api_init', 'placesSearch'); 

Users (erroneously) type a short URL in the Google search box instead of the address bar. How to make it navigate instead of showing search results?

I’m using a URL shortener to publish pronounceable URLs for my pages so I can tell people something like, "Visit mydomain.com/slug to solve that problem." If people go to the address bar of their browser and enter mydomain.com/slug URL there, then the shortened URL works, and it redirects them to the intended destination page. But if a non-technical user goes to the Google search page and enters mydomain.com/slug into the search box there, apparently, Google apparently isn’t smart enough to recognize that they typed in a URL. It tries instead to search for the URL as keywords and comes back with a list of search results.

When I click "New Tab" in my browser, I know the difference between the address bar and the search box, but many non-technical users don’t, and Google gives the same instructions in both places. Both locations claim to accept both search terms and URLs, but apparently they have different logic for determining which is which. For them to behave differently and not follow the URL when it’s typed into the search box instead of the browser address bar seems to be a fatal flaw in the entire concept of shortened URLs – unless there’s something else I can do to make them work regardless of which field someone types them into. Certainly I can’t be the only one facing this.

What can I do to teach Google that my shortened URL is indeed a URL and when someone types it in the search box, it should go to the place where that URL redirects to?

Does Warding Bond carry over damage type?

The warding bond spell description states:

While the target is within 60 feet of you, it gains a +1 bonus to AC and saving throws, and it has resistance to all damage. Also, each time it takes damage, you take the same amount of damage.

If you cast the spell on another creature and then that creature is damaged, what type is the damage you take? If the target receives 12 slashing damage, do you get 6 slashing damage, or just 6 (untyped) damage?

Doing add_rewrite_rule only for specific post type

so I have these two rules for projects CPT.

function addMyRules(){      // variables     add_rewrite_tag('%eventid%','([^&]+)');     add_rewrite_tag('%version%','([^&]+)');      // release-template rewrite     add_rewrite_rule('^projects/([^/]*)/([^/]*)/?$  ','index.php?projects=$  matches[1]&version=$  matches[2]','top');     add_rewrite_rule('^projects/([^/]*)/releases/?$  ','index.php?projects=$  matches[1]&version=releases','top');      flush_rewrite_rules(); }  add_action( 'init', 'addMyRules' ); 

But I have to get rid of that /projects/ prefix for some reason. However if I remove it, we end up having a problem that any page that has .com/something/else format would trigger rewrite.

Any way I could loop thru that custom post type and allow rewrite to run only if first var is one of post slugs?

Thanks!

Better way of handling incorrect date format in a column with “char(10)” data type / TRY_CONVERT equivalent in PLSQL

I have a source table with below structure:

create table customer_info (customer_num    number,  birth_date      char(10)) 

Unfortunately the birth_date column data type is char(10) instead of date. Some example data for this table would be like below:

customer_num    |  birth_date         --------------------------------   1             |  2001/01/01               1             |  2010/01/01               1             |  2021/01/01                1             |  12hhhhuu6   --> Incorrect date             1             |  2001/01/01               1             |  2001/23/01  --> Incorrect date 

what I’ve done is writing a function to evaluate every single record and return it’s correct format but as you know , using a function for every single record is nod a good idea and it somehow kills performance. I was wondering if you could suggest a better way for this.

create or replace function new_to_date_en(d varchar2) return DATE is   v_date date; begin   select to_date(d,'yyyy/mm/dd' ) into v_date from dual;   return to_date(d,'yyyy/mm/dd');   exception when others then return to_dateto_date('2021/03/07', 'yyyy/mm/dd'); end;   

Using the function:

 select customer_num,         new_to_date_en(birth_date)  from customer_info; 

There is a way in T-SQL COALESCE(TRY_CONVERT(date, @date, 111), '2012-01-01'). Is there a similar way in oracle plsql?

Thanks in advance

What’s the type of damage for a multi-typed weapon damage?

Say i play a level 7 Arcane Trickster Rogue with a Shadow Blade equipped which deals 2d8 Psychic damage. In addition I used Absorb Elements with which i absorbed an Ice Mephit’s Frost Breath on me, which would add 1d6 Cold damage to that attack. Lastly I cast Green-Flame-Blade to finally make my attack which would add 1d8 Fire damage. As the Ice Mephit is resistant to Cold but weak to Fire, I get that the additional damage from Absorb Elements would be halved, but Green-Flame-Blade would be doubled. Now to the sneak Attack:

Beginning at 1st level, you know how to strike subtly and exploit a foe’s distraction. Once per turn, you can deal an extra 1d6 damage to one creature you hit with an attack if you have advantage on the attack roll. The attack must use a finesse or a ranged weapon.

As the Sneak attack inherits the weapon attack’s type, how would i calculate the damage for the sneak attack?

  1. Do I choose which type the sneak attack is?
  2. Is it all types at once, and I count the amount of time an element is resisted or is strong against the enemy? (in this case 1. resistance and 1 vulnerability would neutralise and I’d just take the normal result from my sneak attack die)
  3. Does the damage calculation go by whatever type is more beneficial to a) the attacker or b) the defender?

Disable title block on edit screen for a custom post type

I have a custom post type with a custom block to collect required data and store it in post meta data or standard fields like title or slug, so I don’t want to display the Title block. I can’t disable title support in the CPT, because too much else depends on it.

The only successful attempt so far has been using CSS to target the id "post-title-0" of the for the title and can clearly enqueue a small CSS file depending on the post type, but I don’t want to depend on something set by WordPress that I can’t control; it feels that something in Javascript would be a better way to go if possible. I was wondering if WP provde any hooks for this but haven’t found any.

I’m a javascript novice, having started learning it in the last few weeks in order to write some custom blocks, so am not clear on the extent of what can be acheived with it. (I have 50 years experience of programming, just not in JS).

It would be OK to only hide the title until the post has been saved.

Has anyone any ideas?

Posting to a Custom Post Type from front end – user generated content

Is there a fast and reliable way of posting to a Custom Post type from the front end? My use case is for creating a daily checkin for a fitness trainer. I have created the necessary fields using ACF. And I was trying to create a front end post form using ACF Frontend for Elementor plugin. But in the plugin my post type doesnt show up at all. All in all I’ve tried various methods and I help with something concrete and reliable.

Thanks in advance!