-
-
Save Kuprich/313ccff0fdd3c5f5b7554fbedadeafe4 to your computer and use it in GitHub Desktop.
WordPress Получить ID из ссылки (получить название категории)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Получаем ссылку на объект | |
// Берем из него ID | |
// Выводим название категории по ID | |
<?php | |
$idObj = get_category_by_slug('s_about'); | |
$id = $idObj->term_id; | |
echo get_cat_name($id); | |
?> | |
можно вывести другим способом | |
<?php | |
echo get_category_by_slug('s_about')->cat_name; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment