I can think of three approaches here. The first two ignore using any keys. Instead, I just use command structures.
This first example illustrates the basic idea. Here this is similar to what your example with the keys.
\documentclass{article}
\newcommand\lyimarkup{\bfseries}
\makeatletter
\newcommand\lyititle{@ifstar{\lyititle@starred}{\lyititle@nostar}}
\newcommand\lyititle@starred[2]{\providecommand#1{}\renewcommand#1{#2}}
\newcommand\lyititle@nostar[2]{\providecommand#1{}\renewcommand#1{{\bfseries#2}}}
\makeatother
\begin{document}
\lyititle\x{Hello World}\x
\lyititle*\x{Hello World}\x
\end{document}
This second example illustrates how you could work with something more dynamic as per what you suggested in the comments.
\documentclass{article}
\usepackage{xcolor}
\newcommand\lyicolor[1]{\color{#1}}
\makeatletter
\newcommand\lyitext{\@ifstar{\lyitext@starred}{\lyitext@nostar}}
\newcommand\lyitext@starred[2]{%%
\providecommand#1{}%%
\renewcommand#1{{\renewcommand\lyicolor[1]{}#2}}}
\newcommand\lyitext@nostar[2]{\providecommand#1{}\renewcommand#1{#2}}
\makeatother
\begin{document}
\lyitext\x{ab{\lyicolor{red}cd}ef}\x
\lyitext*\x{ab{\lyicolor{red}cd}ef}\x%% no mark up
\lyitext\x{ab{\lyicolor{red}cd}ef}\x%% mark up restored
\end{document}
I'll leave it for you to work out how to do this with pgfkeys.
The examples given above where written as they are because I wanted to stick closely to what the OP was doing in their MWE. Perhaps the OP wants to use \x in different places throughout the document. But, if that's not the case and if the OP only wants the option of rendering unmarked up text, then the answers above are far more clunky than necessary.
I don't want to assume that the OP (or anyone else stumbling across this answer) understands LaTeX enough to write these examples a bit more simply. So, I provide simplified versions here.
The first example can be rewritten as:
\documentclass{article}
\newcommand\lyimarkup{\bfseries}
\makeatletter
\newcommand\lyititle{@ifstar{\lyititle@starred}{\lyititle@nostar}}
\newcommand\lyititle@starred[1]{#1}
\newcommand\lyititle@nostar[1]{\textbf{#1}}
\makeatother
\begin{document}
\lyititle{Hello World}
\lyititle*{Hello World}
\end{document}
The second example can be rewritten as:
\documentclass{article}
\usepackage{xcolor}
\newcommand\lyicolor[1]{\color{#1}}
\makeatletter
\newcommand\lyitext{\@ifstar{\lyitext@starred}{\lyitext@nostar}}
\newcommand\lyitext@starred[1]{%%
{\renewcommand\lyicolor[1]{}%%
#1}}
\newcommand\lyitext@nostar[1]{#1}
\makeatother
\begin{document}
\lyitext{ab{\lyicolor{red}cd}ef}
\lyitext*{ab{\lyicolor{red}cd}ef}
\lyitext{ab{\lyicolor{red}cd}ef}
\end{document}
If you try to abide by the principle that content and markup should be clearly separated, then this sort of situation is relatively easy to deal with. If you're not used to doing this and you're only thinking about how you want the end product to look, this will take some effort to learn. So, for example, in a math textbook you might bold a word in the text when you first introduce it.
Instead of writing
\textbf{new fangled word}
you could write something like
\vocab{new fangled word}
where you define
\newcommand\vocab[1]{\textbf{#1}}
It takes some thought about how you're structuring the document. But once you start thinking this way, LaTeX's power really shines through.
\alphawill results in nothing,\"awill results ina,\char`awill results in`a,\verb+123+will results in+123+) – user202729 Jun 29 '22 at 03:31\edef\x{\pgfkeysvalueof{/title}}was going to remove\bfseriesfrom the key? (That's what I understand what you said you wanted to do.) – A.Ellett Jun 29 '22 at 03:36\edefhere is to expand\pgfkeysvalueofto see if its value is blank. But when control sequences are in the value, this causes wrong. Any method to make it work? – lyl Jun 29 '22 at 03:49\bfseriesdoesn't behave nicely in an\[xe]defsort of situation. – A.Ellett Jun 29 '22 at 03:50\pgfkeysvalueofwhose value has control sequences likebfseries? – lyl Jun 29 '22 at 03:54\pgfkeysgetvalue{/title}\xinstead of your\edef. That will not fully expand stuff in the key, instead your\xwould then be\bfseries ABC, but at least it wouldn't break like your\edefdoes. – Skillmon Jun 29 '22 at 10:46\x? – lyl Jun 30 '22 at 03:52