Skip Navigation

[Resolved] Finding the slug of a VIEW created in Block Editor to use in a shortcode

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to get the slug of a View which was crated in the Blocks editor, but I cannot find it.

Solution: If the View's name is a simple Latin character text string, you can usually guess it. It will usually be all lowercase letters, with spaces replaced by hyphens (-). You can find the slug in the posts table of the database under the column "post_name".

Otherwise, edit the post or page where the View was created. Open the browser JavaScript console and run the following code:

WPViews.dataCache.views

You can dig around through the various items to find the slug that corresponds to the name of the View you created in wp-admin.

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by AlimB3245 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1638033

Tell us what you are trying to do? I have a Custom HTML where I've been shown by support how to get result by creating a VIEW in Classic Editor... I'd like to create it using Block Editor but for this I need to have the VIEW name (from the slug) like this.. [wpv-view name="name-of-view"].. this name is easy to get when you create the view in a Classic Editor... How do I get the name of the view when I create it in the Block Editor?

Is there any documentation that you are following?https://toolset.com/forums/topic/split-how-do-find-short-code-for-data-from-custom-fields-how-to-display-all-custom-field-from-child-post/

Is there a similar example that we can see?

What is the link to your site? hidden link

#1638649
screenshot1.png
screenshot2.png

When you create a new View in the Block Editor, you give it a name (see screenshot1.png). Once the View has been created, you can find that name in the right column, General panel, when you select the View block in the Block Editor (see screenshot2.png).

#1638699

Hi Christian

Thanks for the update..:-)..

This name I can get.. but that's not what I was referring to.. I wanted to know the slug field... that name that's created by the system (which we can edit) but it has no spaces.. it's what is used when we have the shortode.. [wpv-field name="name-of-the-field"]

Normally it's the similar as the first time name that we give with all cases converted to lower case etc.. but that's the name I am trying to get so that I can use in a shortcode..

Also is there any way I can use the loop editor functionality without using classic editor?

Regards,
Alim

#1640535
Screen Shot 2020-05-27 at 7.54.19 PM.png

I wanted to know the slug field
Oh I don't think it's displayed in wp-admin anywhere, but you can find it by digging around in the browser inspector or the MySQL the database. Or if it's a simple latin text string you can usually just guess it. It's usually the same as the name of the View but all lower case, with hyphens instead of spaces.

Otherwise, in wp-admin edit the post or page where the View was created. Open the browser JavaScript console and type:

WPViews.dataCache.views

Press return to run the code, then you should be able to find your View in the list of results. Each item contains a slug, a title and a id. Example screenshot attached.

#1651135

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.