Home › Forums › Calendar Products › Events Calendar PRO › Exclude events, venues, organizers from inline link search
- This topic has 6 replies, 3 voices, and was last updated 7 years, 8 months ago by leonardchamber.
-
AuthorPosts
-
August 18, 2016 at 3:22 pm #1153410leonardchamberParticipant
This is hard to explain but … you know how wordpress has the inline link editor as of 4.5?
When you go to add a link in the page or post editor, you start to type the page name and it automatically searches the pages for you, which is really handy except that we have a zillion events with names that are similar to a page we would like to link to. So, you get search results with nothing but “Library” -events- when you are looking for the “Library” page to link to.
This page has a good animation of the inline link editor that shows what I am talking about – http://www.wpbeginner.com/news/whats-new-in-wordpress-4-5/
I would rather just exclude TEC items from this search. It’s going to really confuse my users.
Thanks!
August 18, 2016 at 5:18 pm #1153457NicoMemberHi there,
Thanks for getting in touch with us! Interesting question here π
I’ve googled a bit and hopefully there’s a filter to modify this query! Try pasting the snippet below in your theme’s (or child theme’s) functions.php file:
/* Tribe remove post types from editor link builder */
function tribe_remove_post_types_from_link_builder( $query ) {// bail if the events calendar is not active
if ( !class_exists( 'Tribe__Events__Main' ) ) return false;$remove_post_types = array(
Tribe__Events__Main::POSTTYPE,
Tribe__Events__Main::VENUE_POST_TYPE,
Tribe__Events__Main::ORGANIZER_POST_TYPE
);foreach( $remove_post_types as $post_type ) {
$key = array_search( $post_type, $query['post_type'] );
if( $key ) {
unset( $query['post_type'][$key] );
}
}return $query;
}
add_filter( 'wp_link_query_args', 'tribe_remove_post_types_from_link_builder' );
Please let me know if this works for you,
Best,
NicoAugust 24, 2016 at 11:59 am #1155495leonardchamberParticipantThis reply is private.
- This reply was modified 7 years, 8 months ago by leonardchamber.
August 25, 2016 at 6:30 am #1155767NicoMemberYou are welcome, no problem with the delay π
It’s seems to be a formatting issue, try pasting the snippet in a plain text editor before doing so in the functions.php file. Sometimes this helps, but if it doesn’t then try to remove the spaces/tabs and add those again.
Also please note that you don’t need to add the PHP closing tag ?> to the end of the file, although I don’t think it causes this issue.
Please give this a new try and let me know,
Best,
NicoAugust 25, 2016 at 8:08 am #1155805leonardchamberParticipantFunny, I thought I had pasted into Notepad prior to uploading, but there must have indeed been a formatting issue, because this time it worked fine. The multitudes of events no longer show up when trying to link something. Thank you!!
August 25, 2016 at 9:08 am #1155841NicoMemberWooot! Stocked to hear it works now π
Iβll go ahead and close out this thread, but if you need help with anything else please donβt hesitate to create a new one and we will be happy to assist you.
Best,
Nico -
AuthorPosts
- The topic ‘Exclude events, venues, organizers from inline link search’ is closed to new replies.